| | |
| | | |
| | | public static void Create(string _url, string _method, string _content, string _contentType, int _retry = 3, Action<bool, string> _result = null) |
| | | { |
| | | #if UNITY_WEBGL |
| | | // WebGL请使用CreateAsync |
| | | Debug.LogWarning("[HttpBehaviour] Create() 不支持WebGL,请使用CreateAsync()"); |
| | | _result?.Invoke(false, "WebGL不支持HttpWebRequest"); |
| | | return; |
| | | #else |
| | | var carrier = new GameObject(); |
| | | GameObject.DontDestroyOnLoad(carrier); |
| | | carrier.hideFlags = HideFlags.HideInHierarchy; |
| | | var behaviour = carrier.AddComponent<HttpBehaviour>(); |
| | | behaviour.Begin(_url, _method, _content, _contentType, _retry, _result); |
| | | #endif |
| | | } |
| | | |
| | | /// <summary> |