/// <summary> /// Removes previously instantiated scene(s) /// </summary> public override void ClearScenes() { foreach (Transform child in transform) { Destroy(child.gameObject); } sceneInstance = null; }
/// <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); }
/// <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); }
/// <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); }
protected override void PostInstantiation(IInstantiator instantiator, bool success) { sceneInstance = (instantiator as GameObjectInstantiator).sceneInstance; base.PostInstantiation(instantiator, success); }