コード例 #1
0
 void Awake()
 {
     if (Instanciate == null)
     {
         Instanciate = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
コード例 #2
0
ファイル: Assets.cs プロジェクト: blinkforme/fish
        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);
        }
コード例 #3
0
 private void Awake()
 {
     self = this;
 }