internal override bool InvokeWaitForCompletion() { if (IsDone) { return(true); } if (m_rtdOp.IsValid() && !m_rtdOp.IsDone) { m_rtdOp.WaitForCompletion(); } m_RM?.Update(Time.deltaTime); if (!HasExecuted) { InvokeExecute(); } if (m_loadCatalogOp.IsValid() && !m_loadCatalogOp.IsDone) { m_loadCatalogOp.WaitForCompletion(); m_RM?.Update(Time.deltaTime); //We need completion callbacks to get triggered. } return(m_rtdOp.IsDone && m_loadCatalogOp.IsDone); }
///<inheritdoc /> protected override bool InvokeWaitForCompletion() { if (m_DepOp.IsValid() && !m_DepOp.IsDone) { m_DepOp.WaitForCompletion(); } m_RM?.Update(Time.unscaledDeltaTime); if (!HasExecuted) { InvokeExecute(); } while (!IsDone) { ((IUpdateReceiver)this).Update(Time.unscaledDeltaTime); //We need the operation to complete but it'll take a frame to activate the scene (post 0.9 progress). if (m_Inst.m_Operation.allowSceneActivation && Mathf.Approximately(m_Inst.m_Operation.progress, .9f)) { Result = m_Inst; return(true); } } return(IsDone); }
internal override bool InvokeWaitForCompletion() { if (IsDone) { return(true); } if (!m_DepOp.IsDone) { m_DepOp.WaitForCompletion(); } m_RM?.Update(Time.deltaTime); if (!HasExecuted) { InvokeExecute(); } if (!m_WrappedOp.IsValid()) { return(m_WrappedOp.IsDone); } m_WrappedOp.WaitForCompletion(); return(m_WrappedOp.IsDone); }
public void WhenUWRIsUsed_CompletesSynchronously() { AsyncOperationHandle <GameObject> h = m_Addressables.LoadAssetAsync <GameObject>(GetForceUWRAddrName(0)); h.WaitForCompletion(); h.Release(); }
///<inheritdoc /> protected override bool InvokeWaitForCompletion() { if (IsDone) { return(true); } if (!m_DepOp.IsDone) { m_DepOp.WaitForCompletion(); } m_RM?.Update(Time.unscaledDeltaTime); if (!HasExecuted) { InvokeExecute(); } if (!m_WrappedOp.IsValid()) { return(m_WrappedOp.IsDone); } Result = m_WrappedOp.WaitForCompletion(); return(true); }
/// <inheritdoc /> protected override bool InvokeWaitForCompletion() { if (IsDone) { return(true); } if (m_DepOp.IsValid() && !m_DepOp.IsDone) { m_DepOp.WaitForCompletion(); } m_RM?.Update(Time.unscaledDeltaTime); if (!HasExecuted) { InvokeExecute(); } if (m_CleanCacheOp.IsValid() && !m_CleanCacheOp.IsDone) { m_CleanCacheOp.WaitForCompletion(); } m_Addressables.ResourceManager.Update(Time.unscaledDeltaTime); return(IsDone); }
/// <summary> /// This special loading function is only used in the editor, when the developer presses Play in a Location scene, without passing by Initialisation. /// </summary> private void LocationColdStartup(GameSceneSO currentlyOpenedLocation, bool showLoadingScreen, bool fadeScreen) { _currentlyLoadedScene = currentlyOpenedLocation; if (_currentlyLoadedScene.sceneType == GameSceneSO.GameSceneType.Location) { //Gameplay managers is loaded synchronously _gameplayManagerLoadingOpHandle = _gameplayScene.sceneReference.LoadSceneAsync(LoadSceneMode.Additive, true); _gameplayManagerLoadingOpHandle.WaitForCompletion(); _gameplayManagerSceneInstance = _gameplayManagerLoadingOpHandle.Result; StartGameplay(); } }
void Start() { opHandle = Addressables.LoadAssetAsync <GameObject>(address); opHandle.WaitForCompletion(); // Returns when operation is complete if (opHandle.Status == AsyncOperationStatus.Succeeded) { Instantiate(opHandle.Result, transform); } else { Addressables.Release(opHandle); } }
internal override bool InvokeWaitForCompletion() { if (m_dependency.IsValid() && !m_dependency.IsDone) { m_dependency.WaitForCompletion(); } m_RM?.Update(Time.deltaTime); if (m_instance == null && !HasExecuted) { InvokeExecute(); } return(m_instance != null); }
public IEnumerator WhenUWRExceedsMaxLimit_CompletesSynchronously() { List <AsyncOperationHandle <GameObject> > loadOps = Enumerable.Range(0, kForceUWRBundleCount).Select(x => m_Addressables.LoadAssetAsync <GameObject>(GetForceUWRAddrName(x))).ToList(); AsyncOperationHandle <GameObject> lastHandle = loadOps[kForceUWRBundleCount - 1]; lastHandle.WaitForCompletion(); lastHandle.Release(); for (int i = 0; i < kForceUWRBundleCount - 1; i++) { AsyncOperationHandle <GameObject> handle = loadOps[i]; yield return(loadOps[i]); handle.Release(); } }
private IEnumerator LoadAssets <T>(HashSet <string> keys, Dictionary <string, T> cache, bool sync = false) where T : UnityEngine.Object { int n = 0; if (VERBOSE) { Debug.Log($"Loading {keys.Count}"); } AsyncOperationHandle <IList <T> > op = default; try { op = Addressables.LoadAssetsAsync <T>(keys, obj => { cache[obj.name] = obj; n++; }, Addressables.MergeMode.Union); } catch (Exception e) { Debug.LogWarning("Exception while trying to load keys: " + e.Message); Debug.LogWarning("Keys: " + keys.ToJoinedString()); yield break; } while (!op.IsDone) { if (sync) { op.WaitForCompletion(); } else { yield return(null); } } //yield return op; if (VERBOSE) { Debug.Log($"Found {n} items"); } }
/// <inheritdoc /> protected override bool InvokeWaitForCompletion() { if (!m_DepOp.IsDone) { m_DepOp.WaitForCompletion(); } if (!HasExecuted) { InvokeExecute(); } if (m_EnumerationThread != null) { m_EnumerationThread.Join(); RemoveCacheEntries(); } return(IsDone); }
internal override bool InvokeWaitForCompletion() { if (IsDone) { return(true); } if (m_DepOp.IsValid() && !m_DepOp.IsDone) { m_DepOp.WaitForCompletion(); } m_RM?.Update(Time.deltaTime); if (!HasExecuted) { InvokeExecute(); } m_Addressables.ResourceManager.Update(Time.deltaTime); return(IsDone); }
/// <inheritdoc /> protected override bool InvokeWaitForCompletion() { if (IsDone) { return(true); } if (m_DepOp.IsValid() && !m_DepOp.IsDone) { m_DepOp.WaitForCompletion(); } m_RM?.Update(Time.deltaTime); if (!HasExecuted) { InvokeExecute(); } m_RM?.Update(Time.deltaTime); return(IsDone); }
///<inheritdoc /> protected override bool InvokeWaitForCompletion() { if (m_DepOp.IsValid() && !m_DepOp.IsDone) { m_DepOp.WaitForCompletion(); } m_RM?.Update(Time.deltaTime); if (!HasExecuted) { InvokeExecute(); } //We need the operation to complete but it'll take a frame to activate the scene. m_Inst.m_Operation.allowSceneActivation = false; while (!IsDone) { ((IUpdateReceiver)this).Update(Time.deltaTime); } //Reset value on scene load operation so we don't activate a scene that a user doesn't want to activate on load. m_Inst.m_Operation.allowSceneActivation = m_ActivateOnLoad; return(IsDone); }