Exemple #1
0
        private void ResponseArrived(AsyncOperation asyncOperation)
        {
            UnityWebRequest request = ((UnityWebRequestAsyncOperation)asyncOperation).webRequest;

#if UNITY_2020_2_OR_NEWER
            if (request.result == UnityWebRequest.Result.ProtocolError || request.result == UnityWebRequest.Result.ConnectionError)
#else
            if (request.isHttpError || request.isNetworkError)
#endif
            {
                Debug.LogError("Failed to create parameter: " + request.error);
#if UNITY_2020_2_OR_NEWER
                if (request.result != UnityWebRequest.Result.ConnectionError)
#else
                if (!request.isNetworkError)
#endif
                {
                    Debug.LogError(request.downloadHandler.text);
                }
                OnCreationFailed?.Invoke();
            }
            else
            {
                OnParameterCreated?.Invoke(JsonUtility.FromJson <DDNAEventManagerEventParameter>(request.downloadHandler.text));
            }
        }
Exemple #2
0
        private void ResponseArrived(AsyncOperation asyncOperation)
        {
            UnityWebRequest request = ((UnityWebRequestAsyncOperation)asyncOperation).webRequest;

            if (request.isHttpError || request.isNetworkError)
            {
                Debug.LogError("Failed to create parameter: " + request.error);
                if (!request.isNetworkError)
                {
                    Debug.LogError(request.downloadHandler.text);
                }
                OnCreationFailed?.Invoke();
            }
            else
            {
                OnParameterCreated?.Invoke(JsonUtility.FromJson <DDNAEventManagerEventParameter>(request.downloadHandler.text));
            }
        }