Class SceneTemplateAsset
Asset storing everything needed to instantiate a scene from a templated scene
Inherited Members
Namespace: UnityEditor.SceneTemplate
Assembly: solution.dll
Syntax
[Serializable]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.scene-template@latest/")]
[CreateAssetMenu(menuName = "Scene Template", order = 201)]
public class SceneTemplateAsset : ScriptableObject
Fields
addToDefaults
If this template is tagged as add to defaults, it will be put in the defaults list of the new scene dialog.
Declaration
public bool addToDefaults
Field Value
Type | Description |
---|---|
bool |
dependencies
List of dependencies of the scene and what to do (Clone or Reference) with each dependency.
Declaration
public DependencyInfo[] dependencies
Field Value
Type | Description |
---|---|
DependencyInfo[] |
description
Description of the template (can be long, displayed in multiline UI).
Declaration
public string description
Field Value
Type | Description |
---|---|
string |
preview
Preview/Icon of the template.
Declaration
public Texture2D preview
Field Value
Type | Description |
---|---|
Texture2D |
templateName
Pretty name for the template asset. By default: the file name of the template
Declaration
public string templateName
Field Value
Type | Description |
---|---|
string |
templatePipeline
Script dering from ISceneTemplatePipeline allowing custom code to be executed on template instantiation.
Declaration
public MonoScript templatePipeline
Field Value
Type | Description |
---|---|
MonoScript |
templateScene
Scene that will be copied when instantiating the template
Declaration
public SceneAsset templateScene
Field Value
Type | Description |
---|---|
SceneAsset |
Properties
IsValid
Is the template valid? If not it wont be displayed in the New Scene Dialog.
Declaration
public bool IsValid { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
AddThumbnailToAsset(Texture2D)
Set the preview of the template and store it in the template asset itself.
Declaration
public void AddThumbnailToAsset(Texture2D thumbnail)
Parameters
Type | Name | Description |
---|---|---|
Texture2D | thumbnail | Thumbnail or preview of the template |
BindScene(SceneAsset)
Assign a new scene to the template and recompute all dependencies
Declaration
public void BindScene(SceneAsset scene)
Parameters
Type | Name | Description |
---|---|---|
SceneAsset | scene |
CreatePipeline()
Instantiate a SceneTemplatePipeline. This is done on each template instantiation.
Declaration
public ISceneTemplatePipeline CreatePipeline()
Returns
Type | Description |
---|---|
ISceneTemplatePipeline | New instance of a ISceneTemplatePipeline that will be notified throughout the whole template instantiation process |
IsValidPipeline(MonoScript)
Validate if a given script contains a class deriving from ISceneTemplatePipeline
Declaration
public static bool IsValidPipeline(MonoScript script)
Parameters
Type | Name | Description |
---|---|---|
MonoScript | script | Script to check if ISceneTemplatePipeline instance is available. |
Returns
Type | Description |
---|---|
bool | True if the given script implements ISceneTemplatePipeline |
UpdateDependencies()
Refresh all the dependencies of the template.
Declaration
public void UpdateDependencies()