Web报错:路径问题
This commit is contained in:
@ -28,6 +28,26 @@ public class WebRequsetTool : Singleton<WebRequsetTool>
|
||||
StartCoroutine(PostRequest(url, data, action));
|
||||
}
|
||||
|
||||
public void GetTexture(string url, UnityAction<Texture2D> action)
|
||||
{
|
||||
StartCoroutine(GetRequestTexture(url, action));
|
||||
}
|
||||
|
||||
IEnumerator GetRequestTexture(string url, UnityAction<Texture2D> action)
|
||||
{
|
||||
UnityWebRequest unityWebRequestTexture = UnityWebRequestTexture.GetTexture(url);
|
||||
yield return unityWebRequestTexture.SendWebRequest();
|
||||
|
||||
if (unityWebRequestTexture.result != UnityWebRequest.Result.Success)
|
||||
{
|
||||
Debug.LogError(unityWebRequestTexture.error);
|
||||
}
|
||||
else
|
||||
{
|
||||
action?.Invoke(DownloadHandlerTexture.GetContent(unityWebRequestTexture));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 完成网络GET请求
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user