文档

Unity Engine

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.
阅读时间1 分钟最后更新于 11 天前

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.