private static StandardBundle GetBundleForScene(string scene) { StandardBundle value = null; sStandardBundles.TryGetValue(scene, out value); return(value); }
public static void LoadScene(string scene) { StandardBundle bundleForScene = GetBundleForScene(scene); if (bundleForScene == null) { Debug.Log("Scene not found: " + scene); return; } int num = bundleForScene.mRequires.Length; AssetBundle returnedBundle; string variantBundleName; for (int i = 0; i < num; i++) { LoadBundle(bundleForScene.mRequires[i], out returnedBundle, out variantBundleName, async: false); if (returnedBundle == null) { Debug.Log("Failed to load bundle: " + bundleForScene.mRequires[i]); return; } } LoadBundle(bundleForScene.mSceneBundle, out returnedBundle, out variantBundleName, async: false); if (returnedBundle == null) { Debug.Log("Failed to load main scene bundle: " + bundleForScene.mSceneBundle); } string text = FindScene(returnedBundle, scene); if (text == null) { Debug.Log("Failed to find scene in bundle: " + text); } SceneManager.LoadScene(text); }
public static LoadingCurrentScene LoadSceneAsync(string scene) { StandardBundle bundleForScene = GetBundleForScene(scene); if (bundleForScene == null) { Debug.Log("Scene not found: " + scene); return(null); } StartNewLoad(scene, bundleForScene); return(sCurrentLoad); }
public void Shutdown() { if (!_allowSceneActivation) { mSceneLoader.allowSceneActivation = true; } mBundleLoader = null; mSceneLoader = null; mCurrentBundle = null; mActive = false; mCurrentPhase = LoadingScenePhase.kNone; }
private static void StartNewLoad(string scene, StandardBundle bundle) { if (sCurrentLoad.mActive) { sCurrentLoad.Shutdown(); } sCurrentLoad.mSceneName = scene; sCurrentLoad.mCurrentBundle = bundle; sCurrentLoad.mCurrentRequired = 0; sCurrentLoad.mCurrentPhase = LoadingScenePhase.kRequiredFileLoad; sCurrentLoad.mBundleLoader = null; sCurrentLoad.mSceneLoader = null; sCurrentLoad.mActive = true; }