IEnumerator RequestSynth(string textToSynth, Action <byte[]> callback) { UnityWebRequest request = UnityWebRequest.Get(GetURL(textToSynth)); yield return(request.SendWebRequest()); if (request.error != null) { Logger.Log("Err: " + request.error, Category.Audio); } else { callback.Invoke(request.downloadHandler.data); } }
private static UnityNetworkingRequest CreateWebRequest(string url, WWWForm wwwForm, bool isAsset) { UnityNetworkingRequest result = null; if (wwwForm == null) { result = UnityNetworkingRequest.Get(url); } else if (isAsset) { result = UnityWebRequestAssetBundle.GetAssetBundle(url, 1); } else { result = UnityNetworkingRequest.Post(url, wwwForm); } return(result); }