Version: Unity 6.3 Beta (6000.3)
LanguageEnglish
  • C#

PhysicsBody.CreateBatch

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static NativeArray<PhysicsBody> CreateBatch(LowLevelPhysics2D.PhysicsWorld world, LowLevelPhysics2D.PhysicsBodyDefinition definition, int bodyCount, Unity.Collections.Allocator allocator);

Parameters

Parameter Description
world The world to create the bodies in.
definition The body definition to use for all bodies.
bodyCount The number of bodies to create.
allocator The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.

Returns

NativeArray<PhysicsBody> The created bodies. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty.

Description

Create a batch of bodies in the specified world.


Declaration

public static NativeArray<PhysicsBody> CreateBatch(LowLevelPhysics2D.PhysicsWorld world, ReadOnlySpan<PhysicsBodyDefinition> definitions, Unity.Collections.Allocator allocator);

Parameters

Parameter Description
world The world to create the bodies in.
definitions The definitions used to create the bodies. The number of bodies produced is implicitly controlled by the number of definitions in this span.
allocator The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.

Returns

NativeArray<PhysicsBody> The created bodies. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty.

Description

Create a batch of bodies in the specified world.