void Awake() { if (Instanciate == null) { Instanciate = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
public static SceneAssetRequest LoadSceneAsync(string path, bool additive = false) { Assert.IsNotNull(path, "path != null"); string assetBundleName; path = GetSearchPath(path, out assetBundleName); var asset = new SceneAssetAsyncRequest(path, additive) { assetBundleName = assetBundleName }; Log(string.Format("LoadSceneAsync:{0}", path)); asset.Load(); asset.Retain(); asset.name = path; LoadingScenes.Add(asset); if (!additive) { if (_runningScene != null) { _runningScene.Release(); _runningScene = null; } _runningScene = asset; } else { if (_runningScene != null) { _runningScene.additives.Add(asset); } } return(asset); }
private void Awake() { self = this; }