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.
阅读时间1 分钟最后更新于 2 天前
Definition
- Type: Method
- Namespace: UnityEngine.LowLevelPhysics2D
- Assembly: UnityEngine.Physics2DModule
public static int GetLayerOrdinal(string layerName)
Parameters
The layer name (case sensitive) to find the layer ordinal for.
Returns
Type | Description |
|---|---|
| int | The 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. |
Remarks
When the full layers are active and more than one layer has the same name, only the lowest-numbered layer with that name is found, so the ordinal of any other layer with that name is never returned.