Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetLayerOrdinal(string)

Get 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.
Read time 1 minuteLast updated 10 days ago

Definition

  • Type: Method
  • Namespace: Unity.U2D.Physics
  • Assembly: UnityEngine.PhysicsCore2DModule
public static int GetLayerOrdinal(string layerName)

Parameters

layerName

The layer name (case sensitive) to find the layer ordinal for.

Returns

Type

Description

intThe layer ordinal associated with the specified layer name or, if not found, PhysicsLayers.InvalidLayerOrdinal will be returned in which case a console warning will also be produced.