Ejemplo n.º 1
0
 void Awake()
 {
     if (Instanciate == null)
     {
         Instanciate = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 private void Awake()
 {
     self = this;
 }