Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SetOwnerUserData

Set PhysicsUserData that can be used for any purpose, typically by the owner only.
Read time 1 minuteLast updated 14 days ago

Definition

  • Type: Method
  • Namespace: Unity.U2D.Physics
  • Assembly: UnityEngine.PhysicsCore2DModule

SetOwnerUserData(PhysicsUserData, int)

Set PhysicsUserData that can be used for any purpose, typically by the owner only.
public void SetOwnerUserData(PhysicsUserData physicsUserData, int ownerKey = 0)

Parameters

physicsUserData

The user data to set.

ownerKey

Optional owner key returned when using PhysicsJoint.SetOwner.

SetOwnerUserData(ReadOnlySpan<PhysicsJoint>, ReadOnlySpan<PhysicsUserData>, int)

Set PhysicsUserData on a batch of joints that can be used for any purpose, typically by the owner only. The joints and userDatas spans must be the same length; joints[n] receives userDatas[n].
public static void SetOwnerUserData(ReadOnlySpan<PhysicsJoint> joints, ReadOnlySpan<PhysicsUserData> userDatas, int ownerKey = 0)

Parameters

The joints to set the owner user data on.

The user data to set, one entry per joint.

ownerKey

Optional owner key returned when using PhysicsJoint.SetOwner.

SetOwnerUserData(ReadOnlySpan<PhysicsJoint>, PhysicsUserData, int)

Set the same PhysicsUserData on a batch of joints that can be used for any purpose, typically by the owner only.
public static void SetOwnerUserData(ReadOnlySpan<PhysicsJoint> joints, PhysicsUserData physicsUserData, int ownerKey = 0)

Parameters

The joints to set the owner user data on.

physicsUserData

The user data to set on every joint.

ownerKey

Optional owner key returned when using PhysicsJoint.SetOwner.