Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


PhysicsLayers

This provides a common method to retrieving layer information. If a PhysicsCoreSettings2D asset is assigned then the full layers ( _physicsLayerNames ) will be used if _usePhysicsLayers is also active. If no PhysicsCoreSettings2D asset is assigned then the global layers (See LayerMask ) will be used.
Read time 1 minuteLast updated 6 days ago

Definition

  • Type: Struct
  • Namespace: Unity.U2D.Physics
  • Assembly: UnityEngine.PhysicsCore2DModule
public readonly struct PhysicsLayers

Static Fields

Value

Description

InvalidLayerOrdinalIndicates an invalid layer ordinal. This is typically used when retrieving a layer ordinal but a name could not be found.

Static Methods

Method

Description

GetLayerMaskGet a PhysicsMask for the specified layer name(s).
GetLayerNameGet a layer name for the specified layer ordinal (index).
GetLayerOrdinalGet a layer ordinal (index) for the specified layer name. This is not a 32-bit mask but simply the layer ordinal (index) associated with the specified layer name.