Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SetBatchDefinition(ReadOnlySpan<PhysicsShape>, PhysicsShapeDefinition)

Set the same shape definition on a batch of shapes by writing all of its properties to each shape, as PhysicsShape.definition would.
Read time 1 minuteLast updated 15 hours ago

Definition

  • Type: Method
  • Namespace: Unity.U2D.Physics
  • Assembly: UnityEngine.PhysicsCore2DModule
public static int SetBatchDefinition(ReadOnlySpan<PhysicsShape> shapes, PhysicsShapeDefinition definition)

Parameters

The shapes to set the definition on.

The definition to set on every shape.

Returns

Type

Description

intThe number of shapes that were ignored (not set because the shape was invalid). A single warning is logged when any are ignored.

Remarks

This is faster than setting PhysicsShape.definition on each shape. Writing every property is slower than setting only the properties you need, so this is best kept out of per-frame code. See PhysicsShape.definition.