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 13 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 PhysicsShape.SetOwner.

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

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

Parameters

The shapes to set the owner user data on.

The user data to set, one entry per shape.

ownerKey

Optional owner key returned when using PhysicsShape.SetOwner.

SetOwnerUserData(ReadOnlySpan<PhysicsShape>, PhysicsUserData, int)

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

Parameters

The shapes to set the owner user data on.

physicsUserData

The user data to set on every shape.

ownerKey

Optional owner key returned when using PhysicsShape.SetOwner.