SetUserData
Set PhysicsUserData on a batch of bodies that can be used for any purpose. The bodies and userDatas spans must be the same length; bodies[n] receives userDatas[n].
Read time 1 minuteLast updated 11 days ago
Definition
- Type: Method
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
SetUserData(ReadOnlySpan<PhysicsBody>, ReadOnlySpan<PhysicsUserData>)
Set PhysicsUserData on a batch of bodies that can be used for any purpose. The bodies and userDatas spans must be the same length; bodies[n] receives userDatas[n].
public static void SetUserData(ReadOnlySpan<PhysicsBody> bodies, ReadOnlySpan<PhysicsUserData> userDatas)
Parameters
The bodies to set the user data on.
The user data to set, one entry per body.
SetUserData(ReadOnlySpan<PhysicsBody>, PhysicsUserData)
Set the same PhysicsUserData on a batch of bodies that can be used for any purpose.
public static void SetUserData(ReadOnlySpan<PhysicsBody> bodies, PhysicsUserData physicsUserData)
Parameters
The bodies to set the user data on.
The user data to set on every body.