# PhysicsUserData

> Custom user data. The physics system doesn't use this data, it is entirely for custom use.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.U2D.Physics](/engine/6000.7/script-reference/unity/u2d/physics.md)
* **Assembly:** UnityEngine.PhysicsCore2DModule
* **Implements:** [IEquatable\<PhysicsUserData>](https://learn.microsoft.com/dotnet/api/system.iequatable-1)

```csharp
public struct PhysicsUserData : IEquatable<PhysicsUserData>
```

## Remarks

To attach a `PhysicsUserData` instance to a [PhysicsWorld](/engine/6000.7/script-reference/unity/u2d/physics/physicsworld.md), [PhysicsBody](/engine/6000.7/script-reference/unity/u2d/physics/physicsbody.md), [PhysicsShape](/engine/6000.7/script-reference/unity/u2d/physics/physicsshape.md), [PhysicsChain](/engine/6000.7/script-reference/unity/u2d/physics/physicschain.md), or [PhysicsJoint](/engine/6000.7/script-reference/unity/u2d/physics/physicsjoint.md), assign it to the object's `userData` property.

Additional Resources: [\_userData](/engine/6000.7/script-reference/unity/u2d/physics/physicsshape/userdata.md)

## Examples

```csharp
// Create custom user data and attach it to a shape.
using UnityEngine;
using Unity.U2D.Physics;

public class PhysicsUserDataExample : MonoBehaviour
{
    void Start()
    {
        PhysicsWorld world = PhysicsWorld.defaultWorld;
        PhysicsBody body = world.CreateBody();
        PhysicsShape myShape = body.CreateShape(new CircleGeometry { radius = 1.5f });

        PhysicsUserData physicsUserData = new PhysicsUserData
        {
            objectValue = this,
            boolValue = true,
            floatValue = 123.4f,
            intValue = 567,
            physicsMaskValue = PhysicsMask.All
        };

        myShape.userData = physicsUserData;
    }
}
```

## Properties

| Property                                                                                                  | Description                                                                                                                                                                                                                     |
| --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [boolValue](/engine/6000.7/script-reference/unity/u2d/physics/physicsuserdata/boolvalue.md)               | A custom bool.                                                                                                                                                                                                                  |
| [floatValue](/engine/6000.7/script-reference/unity/u2d/physics/physicsuserdata/floatvalue.md)             | A custom 32-bit float.                                                                                                                                                                                                          |
| [int64Value](/engine/6000.7/script-reference/unity/u2d/physics/physicsuserdata/int64value.md)             | A custom 64-bit long.                                                                                                                                                                                                           |
| [intValue](/engine/6000.7/script-reference/unity/u2d/physics/physicsuserdata/intvalue.md)                 | A custom 32-bit int.                                                                                                                                                                                                            |
| [objectValue](/engine/6000.7/script-reference/unity/u2d/physics/physicsuserdata/objectvalue.md)           | A custom Unity object. To get the [EntityId](/engine/6000.7/script-reference/unityengine/entityid.md) of the object, use [\_objectValueId](/engine/6000.7/script-reference/unity/u2d/physics/physicsuserdata/objectvalueid.md). |
| [objectValueId](/engine/6000.7/script-reference/unity/u2d/physics/physicsuserdata/objectvalueid.md)       | The EntityId of a Unity object. This is the object referred to with [\_objectValue](/engine/6000.7/script-reference/unity/u2d/physics/physicsuserdata/objectvalue.md)                                                           |
| [physicsMaskValue](/engine/6000.7/script-reference/unity/u2d/physics/physicsuserdata/physicsmaskvalue.md) | A custom 64-bit [PhysicsMask](/engine/6000.7/script-reference/unity/u2d/physics/physicsmask.md).                                                                                                                                |
| [vector3IntValue](/engine/6000.7/script-reference/unity/u2d/physics/physicsuserdata/vector3intvalue.md)   | A custom [Vector3Int](/engine/6000.7/script-reference/unityengine/vector3int.md).                                                                                                                                               |
