示例#1
0
 // Provides a simple callback handler, passing a boolean representing success/failure
 private static void SimpleCallback(UnityWebRequest request, Action action, Action <bool> callback = null)
 {
     if (request.EncounteredError())
     {
         Debug.LogError(request.GetError());
         callback?.Invoke(false);
     }
     else
     {
         try
         {
             action?.Invoke();
             callback?.Invoke(true);
         }
         catch (Exception e)
         {
             Debug.LogError(e);
             callback?.Invoke(false);
         }
     }
 }