コード例 #1
0
 /// <summary>
 /// Removes previously instantiated scene(s)
 /// </summary>
 public override void ClearScenes()
 {
     foreach (Transform child in transform)
     {
         Destroy(child.gameObject);
     }
     sceneInstance = null;
 }
コード例 #2
0
ファイル: GltfAssetBase.cs プロジェクト: p-skakun/glTFast
        /// <summary>
        /// Creates an instance of the scene specified by the scene index.
        /// </summary>
        /// <param name="sceneIndex">Index of the scene to be instantiated</param>
        /// <param name="instantiator">Receives scene construction calls</param>
        /// <returns>True if instantiation was successful.</returns>
        protected bool InstantiateScene(int sceneIndex, GameObjectInstantiator instantiator)
        {
            if (importer == null)
            {
                return(false);
            }
            var success = importer.InstantiateScene(instantiator, sceneIndex);

            sceneInstance  = instantiator.sceneInstance;
            currentSceneId = success ? sceneIndex : (int?)null;
            return(success);
        }
コード例 #3
0
ファイル: GltfAssetBase.cs プロジェクト: p-skakun/glTFast
        /// <summary>
        /// Creates an instance of the scene specified by the scene index.
        /// </summary>
        /// <param name="sceneIndex">Index of the scene to be instantiated</param>
        /// <param name="logger">Used for message reporting</param>
        /// <returns>True if instantiation was successful.</returns>
        public virtual bool InstantiateScene(int sceneIndex, ILogger logger = null)
        {
            if (importer == null)
            {
                return(false);
            }
            var instantiator = GetDefaultInstantiator(logger);
            var success      = importer.InstantiateScene(instantiator, sceneIndex);

            sceneInstance  = instantiator.sceneInstance;
            currentSceneId = success ? sceneIndex : (int?)null;
            return(success);
        }
コード例 #4
0
ファイル: GltfAssetBase.cs プロジェクト: p-skakun/glTFast
        /// <summary>
        /// Creates an instance of the main scene
        /// </summary>
        /// <param name="logger">Used for message reporting</param>
        /// <returns>True if instantiation was successful.</returns>
        public bool Instantiate(ILogger logger = null)
        {
            if (importer == null)
            {
                return(false);
            }
            var instantiator = GetDefaultInstantiator(logger);
            var success      = importer.InstantiateMainScene(instantiator);

            sceneInstance  = instantiator.sceneInstance;
            currentSceneId = success ? importer.defaultSceneIndex : (int?)null;
            return(success);
        }
コード例 #5
0
 protected override void PostInstantiation(IInstantiator instantiator, bool success)
 {
     sceneInstance = (instantiator as GameObjectInstantiator).sceneInstance;
     base.PostInstantiation(instantiator, success);
 }