要创建新场景,Unity 会复制 场景场景包含游戏的环境和菜单。可以将每个唯一的场景文件视为一个独特的关卡。在每个场景中,您放置环境、障碍物和装饰物,本质上是设计和构建游戏的各个部分。 更多信息
请参阅 术语表 模板。将场景模板视为包含您要开始使用的所有内容的预配置场景。例如,默认的基本模板通常包含一个 相机一个创建场景中特定视点的图像的组件。输出要么绘制到屏幕上,要么作为纹理捕获。 更多信息
请参阅 术语表 和一盏灯光。
您可以创建自己的场景模板来自定义您可以在项目中创建的新场景类型。例如,您可以为游戏中的每个关卡创建模板,以便所有参与项目的人员都可以使用正确的资源和配置开始他们的场景。
您可以从任何 Unity 场景创建模板。创建模板后,可以从模板创建任意数量的新场景。与场景类似,大多数场景模板都是存储在项目中的资源。
本页介绍了重要的场景模板概念。有关创建、编辑和管理场景模板的更多信息,请参阅以下页面
大多数场景模板都是用户定义的,这意味着您是从自己的场景中创建它们。用户定义的场景模板是 Unity 存储在项目中的资源。
Unity 还为每种项目类型提供内置模板。例如,某些项目类型包含一个基本模板,用于创建一个包含相机和灯光的场景,以及一个空模板,用于创建一个空场景。
内置模板与其他模板不同,因为它们不是存储在项目中的资源,并且您无法修改它们。
注意 |
---|
一些 Unity 包还可能包含在您安装包时安装的场景模板。 |
创建场景模板时,您可以指定 Unity 在您从模板创建新场景时是否克隆或引用其依赖项(它包含的资源)。
要指定 Unity 为特定模板克隆的资源,请编辑模板的属性。
典型的模板可能包含克隆和引用资源的混合。Unity 默认将若干资源类型设置为克隆。
要更改 Unity 默认情况下是否克隆或引用给定资源类型,请编辑场景模板项目设置。
克隆的资源是模板场景使用的原始资源的副本。当 Unity 从模板创建新场景时,它会自动修改新场景以使用任何克隆的资源。如果您修改了克隆的资源,它不会影响模板场景。如果您修改了模板场景中的原始资源,它不会影响新场景。
当您希望新场景包含用户可能修改的起始资源集时,克隆模板资源很有用。
引用的资源是模板场景使用的原始资源。当 Unity 从模板创建新场景时,新场景会指向与模板场景相同的资源。如果您修改了这些资源,它会影响新场景和模板场景。
当您希望新场景包含用户在其之上构建但不会修改的默认资源集时,引用模板资源很有用。
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.