Skip to content

Commit

Permalink
Fix deprecation warning about UnityWebRequest error handling in Unity…
Browse files Browse the repository at this point in the history
… 2020
  • Loading branch information
desplesda committed Mar 27, 2021
1 parent 1bb53d0 commit 036253f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Editor/YarnSpinnerEditorWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,14 @@ private static void EditorUpdate()

EditorApplication.update -= EditorUpdate;

if (supportersRequest.isNetworkError || supportersRequest.isHttpError)
bool isError;
#if UNITY_2020_1_OR_NEWER
isError = supportersRequest.result != UnityWebRequest.Result.Success;
#else
isError = supportersRequest.isNetworkError || supportersRequest.isHttpError
#endif

if (isError)
{
Debug.LogError("Error loading Yarn Spinner supporter data: " + supportersRequest.error);
supportersText = ""; // set to the empty string to prevent future loads
Expand Down

0 comments on commit 036253f

Please sign in to comment.