Class SceneTemplate
Namespace: UnityEditor.SceneTemplate
Syntax
public static class SceneTemplate
Methods
CreateSceneTemplate(String)
Create a new Scene template at a specific path. This scene template won't be bound to a scene.
Declaration
public static SceneTemplateAsset CreateSceneTemplate(string sceneTemplatePath)
Parameters
Type | Name | Description |
---|---|---|
String | sceneTemplatePath | Path of the new scene template asset |
Returns
Type | Description |
---|---|
SceneTemplateAsset | A new scene template asset instance |
CreateTemplateFromScene(SceneAsset, String)
Create a new scene template bound to a specific scene. All its dependencies will automatically be extracted and set to reference.
Declaration
public static SceneTemplateAsset CreateTemplateFromScene(SceneAsset sourceSceneAsset, string sceneTemplatePath)
Parameters
Type | Name | Description |
---|---|---|
SceneAsset | sourceSceneAsset | Scene asset that will serve as the template |
String | sceneTemplatePath | new path os the Scene template asset |
Returns
Type | Description |
---|---|
SceneTemplateAsset | A new scene template asset instance |
Instantiate(SceneTemplateAsset, Boolean, String)
Instantiate a new scene from a template.
Declaration
public static Tuple<Scene, SceneAsset> Instantiate(SceneTemplateAsset sceneTemplate, bool loadAdditively, string newSceneOutputPath = null)
Parameters
Type | Name | Description |
---|---|---|
SceneTemplateAsset | sceneTemplate | Scene template asset containing all information to properly instantiate the scene. |
Boolean | loadAdditively | Is the new scene created additively in the currently loaded scene. |
String | newSceneOutputPath | If the new scene needs to be saved on disk, it will be its path. |
Returns
Type | Description |
---|---|
Tuple<Scene, SceneAsset> | It returns a tuple of the newly created scene and its matching scene asset |
Events
newSceneTemplateInstantiated
Events fired after a template is instantiated.
Declaration
public static event SceneTemplate.NewTemplateInstantiated newSceneTemplateInstantiated
Event Type
Type | Description |
---|---|
SceneTemplate.NewTemplateInstantiated |
newSceneTemplateInstantiating
Events fired before a template is instantiated
Declaration
public static event SceneTemplate.NewTemplateInstantiating newSceneTemplateInstantiating
Event Type
Type | Description |
---|---|
SceneTemplate.NewTemplateInstantiating |