Pin properties in 2D Physics Core
Configure global 2D Physics Core settings
Attach custom data to 2D Physics Core objects
To attach custom data to a 2D Physics Core component, use the User Data section of the Inspector window.
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.
Follow these steps:
- Select a GameObject with any 2D Physics Core component.
- In the Inspector window, expand the User Data section.
- Set a value for one of the custom properties. For example, set Int to 42 to attach the integer value of 42 to the component.
To fetch the data in the API, get the userData property of the physics object. For example:
Debug.Log(myShape.userData.intValue);
Additional resources
Pin properties in 2D Physics Core
Configure global 2D Physics Core settings