Version: Unity 7.0 Alpha (7000.0)
Language : English
Configure 2D Physics Core scenes
Pin properties in 2D Physics Core

Share properties across multiple 2D Physics Core components

Note: This documentation is about using Pose, Area, and Constraint components. To use 2D physics in the Unity Editor using components like the Rigidbody 2D component, refer to 2D physics instead.

To share properties across multiple physics objects, use the following:

  • A definition asset to share a set of component properties, such as gravity or friction.
  • A geometry asset to share a shape.

Definition assets and geometry assets are files in the Project window that store the shared values.

Share a set of area properties

Follow these steps:

  1. Right-click in the Project window and select Create > 2D > Physics (Core).

  2. Select the category and definition type you want to create. For example, select Area > Area Definition to create a shared set of properties for any Physics Area component.

    Note: Physics Area components all use the same Area Definition asset type, but each Physics Constraint has its own definition asset type. For the full list, refer to Connecting 2D Physics Core objects.

  3. Select the asset Unity creates in the Project window, then adjust its properties in the Inspector window.

  4. In the Inspector window of any 2D Physics Core component that matches the definition type, drag the definition asset into the Definition Asset property, or select the picker (⊙).

To stop a component using a shared definition asset and revert it to using its own local properties, select Make Local.

Note: For Area components, you can also create a Physics Contact Filter asset to share a different set of contact properties, and a Physics Surface Material asset to share a different set of surface properties. If you provide these assets, they override the same properties in the definition asset.

Share a shape

To share a shape across multiple Area components, create a shared geometry asset. Follow these steps:

  1. Right-click in the Project window and select Create > 2D > Physics (Core) > Area.
  2. Select the shape you want to create, for example Circle Geometry.
  3. Select the asset Unity creates in the Project window, then adjust the properties in the Inspector window.
  4. In the Inspector window of any Physics Area component that matches the geometry type, drag the geometry asset into the Geometry Asset property, or select the picker (⊙).

For the full list of shapes, refer to Physics Pose and Physics Area components.

Save a set of existing properties

To create a definition asset or geometry asset with the current properties of a component, follow these steps:

  1. Select the GameObject with the component you want to create a definition from.
  2. In the Inspector window, next to the relevant Asset field, select Make Asset.
  3. Save the asset.

To stop a component using a shared asset and revert it to using its own local properties, select Make Local.

Change the default definitions

To change the default values of a component, follow these steps:

  1. Create and assign a Physics Core Settings 2D asset. For more information, refer to Configure global 2D Physics Core settings.
  2. In the Project Settings window, select Physics Core 2D > Settings.
  3. Configure the properties in the Default Definitions tab.

Unity uses the default values for components that don’t have a definition asset assigned, and for a newly created definition asset.

For a full list of properties, refer to Physics Core 2D reference.

Additional resources

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