Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


CreateProxyShapes(ReadOnlySpan<PhysicsShape>, Allocator)

Create one proxy per shape, taking each proxy AABB, categories and user handle directly from the shape. This only applies to a space bound to a world, and every shape must be a live shape in that world.
Read time 1 minuteLast updated 12 days ago

Definition

  • Type: Method
  • Namespace: Unity.U2D.Physics
  • Assembly: UnityEngine.PhysicsCore2DModule
public NativeArray<PhysicsSpace.ProxyHandle> CreateProxyShapes(ReadOnlySpan<PhysicsShape> shapes, Allocator allocator = Allocator.Temp)

Parameters

The shapes to create proxies for.

allocator

The memory allocator to use for the results. This can only be Allocator.Temp, Allocator.TempJob or Allocator.Persistent.

Returns

Type

Description

NativeArray<ProxyHandle>The created proxy handles, one per shape in the same order. This NativeArray must be disposed of after use otherwise leaks will occur. The exception to this is if the array is empty.

Remarks

See PhysicsSpace.Create and _sourceWorld. If any shape is invalid or not in the bound world then no proxies are created and an empty array is produced.