Version: 2023.1
Language : English
Import Activity window
Supporting presets

Presets

Presets are assets that you can use to save and apply identical property settings across multiple components, assets, or Project Settings windows. You can also use Presets to specify default settings for new components and default import settings for assets in the Preset Manager The Preset Manager supports any importers, components, or scriptable objects you add to the Unity Editor.

You can only apply Presets in the Editor. Presets have no effect at runtime. You can use scripting to support presets in your own Monobehaviour, ScriptableObject or ScriptedImporter classes.

Saving and applying Presets

Presets allow you to save the property configuration of a component, asset, or Project Settings window as a Preset asset. You can then use this Preset asset to apply the same settings to a different component, asset, or Project Settings window.

For example, you could edit the properties of a RigidbodyA component that allows a GameObject to be affected by simulated gravity and other forces. More info
See in Glossary
component, save these settings to a Preset asset, then apply that Preset asset to Rigidbody components in other GameObjectsThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary
. The other components in the GameObjects are not affected; the Preset only applies its settings to the Rigidbody component.

You can store Presets in the Assets folder of your project. Use the Project window to view and select Presets to edit in the InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
See in Glossary
.

Example of Preset assets in the Project window, organized in a Presets sub-folder
Example of Preset assets in the Project window, organized in a Presets sub-folder

Saving property settings to a Preset

To save property settings to a Preset asset, follow the instructions below. You can save property settings while in Edit mode or in Play mode.

  1. Select the GameObject, Asset import settings, or Project Settings window from which you want to reuse settings. When you select it, it appears in the Inspector window.

  2. In the Inspector window, configure the properties as you want to save them.

  3. Click the Preset selector (the slider icon) at the top-right of the Inspector window.

  4. In the Select Preset window, click Save current to.

    A File Save dialog appears.

  5. Choose the location of your new Preset, enter its name, and click Save.

Applying settings from a Preset

There are two ways to apply a Preset: the Select Preset window, or for component Presets, you can also drag and drop a Preset from the ProjectIn Unity, you use a project to design and develop a game. A project stores all of the files that are related to a game, such as the asset and Scene files. More info
See in Glossary
window onto the GameObject that contains that component.

Note: Applying a Preset copies properties from the Preset to the item. It doesn’t link the Preset to the item. Changes you make to the Preset do not affect the items you have previously applied the Preset to.

To apply a Preset via the Select Preset window:

  1. For GameObjects or assets you want to apply a Preset to, select them so that they appear in the Inspector window. For Project Settings that you want to apply a Preset to, open them in the Project SettingsA broad collection of settings which allow you to configure how Physics, Audio, Networking, Graphics, Input and many other areas of your project behave. More info
    See in Glossary
    window.

  2. In the Inspector, click the Preset selector (the slider icon).

  3. In the Select Preset window, search for and select the Preset to apply.

    Unity applies this Preset to the component, asset, or Project Settings window.

  4. Close the Select Preset window.

If you apply a component Preset via drag-and-drop, Unity’s behavior depends on the state of your GameObject:

  • If you drop the Preset on an existing GameObject in the Hierarchy window, Unity adds a new component and copies properties from the Preset.
  • If you drop the Preset on an empty area in the Hierarchy window, Unity creates a new, empty GameObject and adds a component with properties copied from the Preset.
  • If you drop the Preset on the Inspector window onto the title of an existing component, Unity copies properties from the Preset.
  • If you drop the Preset on an empty area in the Inspector window, Unity adds a new component and copies properties from the Preset.

Applying partial Presets

You can choose to only apply some properties from a Preset and exclude others. To do this:

  1. Select your Preset in the Project window.

  2. In the Inspector, right-click a property and choose Exclude Property. The window displays a red horizontal line next to excluded properties.

  3. Apply the Preset to the target component, asset, or Project settings.

Note: To select all or clear all checkboxes in a Preset, select the More items menu () or right-click the Preset name, and select Include all properties or Exclude all properties. You can still adjust individual properties if you need to.

You can also use the Exclude option for Presets that you then set as the default configuration for components and asset importers. See Preset Manager for more details on how to do this.

Editing a Preset

To edit a Preset asset, select it from the Project window and view it in the Inspector window.

Note: When you change the properties in a Preset, your changes do not affect items you have already applied the Preset to. For example, if you apply a Preset for a Rigidbody component to a GameObject, and then edit the Preset, the settings in the Rigidbody component do not change.

Editing a Preset in the Inspector window
Editing a Preset in the Inspector window

Importing Assets using Presets by folder

You can use a script to apply a Preset to an Asset based on the location of the Asset in the Project window.

Exporting Preset Assets

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 asset packageA collection of files and data from Unity projects, or elements of projects, which are compressed and stored in one file, similar to Zip files, with the .unitypackage extension. Asset packages are a handy way of sharing and re-using Unity projects and collections of assets. More info
See in Glossary
. Your team members can import this asset package into their projects.

  1. In the Project windowA window that shows the contents of your Assets folder (Project tab) More info
    See in Glossary
    , select the Presets you want to export .
  2. In the Unity menu, go to Assets > Export Package, or right-click inside the Project window and choose Export Package.
    The Exporting package window displays the items to export.
  3. If your Presets contain references to assets you want to include in the package, enable Include dependencies.
  4. Click Export.
  5. Choose where you want to store the package, enter a filename, and click Save. Unity saves the package as a .unitypackage file.

Using Presets for transitions of Animation State nodes

You can save and apply Presets for Animation State nodes. However, the transitionsThe blend from one state to another in a state machine, such as transitioning a character from a walk to a jog animation. Transitions define how long the blend between states should take, and the conditions that activate the blend. More info
See in Glossary
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 windowThe window where the Animator Controller is visualized and edited. More info
See in Glossary
. 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.


2017–03–27 Page published

New feature in 2018.1 NewIn20181

Import Activity window
Supporting presets
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961