您可以通过以下方式之一创建新的场景模板:
提示: |
---|
在从场景创建模板之前,先使用场景名称创建一个文件夹,然后将要克隆的任何资源放入其中。创建模板时,Unity 会自动为这些资源启用 Clone。有关详细信息,请参阅编辑场景模板。 |
您可以创建空的场景模板并在以后配置它们。空模板仅在您编辑其属性为其关联场景资源后,才会出现在 New Scene 对话框中。
要在当前项目文件夹中创建一个空的场景模板:
要在特定项目文件夹中创建一个空的场景模板:
执行以下操作之一:
在 Project 窗口中,右键单击文件夹以打开上下文菜单。
在 Project 窗口中打开文件夹,然后右键单击资源窗格以打开上下文菜单。
选择 Create > Scene Template。
您可以将任何现有场景转换为场景模板。从现有场景创建模板后,您可能想要编辑其属性指定从该模板创建新场景时 Unity 克隆它的哪些依赖项。
要从现有场景资源创建模板,请打开 Project 窗口,然后执行以下操作之一:
要从当前场景创建场景模板,请从菜单中选择 File > Save As Scene Template。
如果您有未保存的更改,Unity 会在保存模板之前提示您保存场景。
从当前场景创建模板后,您可能想要编辑其属性指定从该模板创建新场景时 Unity 克隆它的哪些依赖项。
您可以从 C# 脚本创建场景模板。
要创建一个空的场景模板,请使用 CreateSceneTemplate 方法。
SceneTemplate.CreateSceneTemplate(string sceneTemplatePath)
要从现有场景创建模板,请使用 CreateTemplateFromScene 方法 。Unity 自动将场景与模板关联,并提取场景的依赖项。
SceneTemplate.CreateTemplateFromScene(SceneAsset sourceSceneAsset, string sceneTemplatePath);
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.