Ejemplo n.º 1
0
        // Sends a WebRequest given as a parameter and checks its status every millisecondsPerUpdate
        public UnityWebRequestAsyncOperation Send(UnityWebRequest request, int millisecondsPerUpdate)
        {
            // Start a TaskInvoker task and send the UnityWebRequest.
            int taskID = TaskInvoker.StartTask(millisecondsPerUpdate, onInvoke, onExpire);

            runningRequests.Add(new WrappedRequest(request, taskID));
            return(request.SendWebRequest());
        }
Ejemplo n.º 2
0
 void OnApplicationPause(bool paused)
 {
     // Start the counter on pause
     if (paused)
     {
         // Start a task that invokes once every second (1000 milliseconds)
         currentTaskID = TaskInvoker.StartTask(1000, onInvoke, onExpire);
     }
     else if (currentTaskID != -1)
     {
         // Stop the running task when entering foreground
         TaskInvoker.StopTask(currentTaskID);
     }
 }