使用预设可在多个组件和资源之间重用属性设置。
With Presets you can also specify default settings for new components and the import settings for Assets. Use the Presets settings to view and choose the Presets to use for default settings.
Use Presets to streamline your team’s workflows. You can even use Presets to specify settings for Project Settings windows, including the Preset settings themselves. Use this feature to configure a project then export it as a custom package. Your team members can import this package into their projects.
预设功能只能在 Editor 中使用。可在 Unity Editor 的扩展中支持预设。预设不能在运行时用于 Unity Player。
通过复制和粘贴等方式即可使用预设。但是,不会将设置复制到剪贴板,而是保存设置供以后使用。与粘贴设置一样,将预设应用于某个项会更改此项中的属性。
例如,选择一个游戏对象来编辑其刚体 (RigidBody) 组件的属性。将这些设置保存到预设。然后,可将该预设应用于其他游戏对象中的刚体组件。游戏对象中的其他组件不受影响;预设仅将其设置应用于刚体组件。
You can store Presets in the Assets
folder of your project. Use the Project window to view and select Presets to edit in the Inspector.
使用 Select Preset 窗口可保存属性设置。
提示:还可以在播放模式下保存预设。
要将设置保存到预设,请执行以下操作:
5.选择新预设的位置,输入其名称,然后单击 Save。
要应用已保存的预设,可使用 Select Preset 窗口,或者将某个预设从 Project 窗口拖放到游戏对象上。
注意:应用预设会将属性从预设复制到该项。此过程不会将预设链接到该项。对预设所做的更改不会影响先前已应用预设的项。
To apply a Preset to a Project Settings window, an existing component, or import settings for an Asset:
2.在 Inspector 中,单击 Preset 图标。
3.在 Select Preset 窗口中,搜索并选择要应用的预设。
Selecting the Preset applies it to the component, asset, or Project Settings window.
4.关闭 Select Preset 窗口。
Drag and drop a Preset from the Project window to apply properties to a component in a GameObject:
Drop the Preset on an empty spot in the Hierarchy window. Unity creates a new, empty GameObject and adds a component with properties copied from the Preset.
将预设放在 Hierarchy 中的现有游戏对象上。Unity 会添加新组件并从预设复制属性。
Drop the Preset on the Inspector window at the end of a GameObject. Unity adds a new component and copies properties from the Preset.
将预设放在 Inspector 中某个现有组件的名称上。Unity 会从预设复制属性。
You can save and apply Presets for Animation State nodes. However, the transitions in the Preset are shared among Presets and the nodes that you apply the Preset to. For example, you apply a Preset to two different nodes in the Animator window. In the Inspector window, you edit the settings for one of the transitions in the first node. Your change also appears in the other node and in the Preset.
You can save Presets for Asset import settings. However, applying a Preset to import settings does not affect the cross-platform settings. To apply a Preset so that it includes cross-platform settings, set the Preset as a default then use the Reset command.
You can also use a script to apply a Preset to an Asset based on the location of the Asset in the Project window.
Use the Inspector window to edit a Preset Asset.
注意:更改预设中的属性不会更新已应用预设的项。例如,如果将刚体组件的预设应用于游戏对象,然后编辑该预设,则刚体组件中的设置不会更改。
2017–03–27 Page published with limited editorial review
New feature in 2018.1 NewIn20181