/// <summary>Advances this request by checking in on it's progress.</summary> public void Update(float deltaTime) { if (WWWRequest == null) { // Not setup yet. return; } if (LoadingEnumerator == null) { // Let's go! LoadingEnumerator = Loader(); // Advance the first time: LoadingEnumerator.MoveNext(); } Duration += deltaTime; if (Duration >= Timeout_) { // Timeout! Package.TimedOut(); // Done: Remove(); return; } if (WWWRequest.isDone) { if (Package.readyState_ < 2) { // Load the headers: HandleHeaders(); } if (Errored) { // Figure out a suitable error code: Package.statusCode = ErrorHandlers.GetUnityErrorCode(Error); } if (!WWWRequest.isDone) { // Yes, this is actually possible! Quit and go around again: return; } // Received: #if UNITY_2017_1_OR_NEWER byte[] bytes = WWWRequest.downloadHandler.data; #else byte[] bytes = WWWRequest.bytes; #endif Package.ReceivedData(bytes, 0, bytes.Length); // Pop it from the update queue: Remove(); } else if (Progress != 0f) { if (Package.readyState_ < 2) { // Got headers yet? HandleHeaders(); #if !MOBILE && !UNITY_WEBGL && !UNITY_TVOS } else if (Package.readyState_ == 2 && Movie != null && Movie.isReadyToPlay) { // Downloaded it far enough to try playing it - let the package know: Package.ReceivedMovieTexture(Movie); #endif } } }