# 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.

## Definition

* **Type:** Method
* **Namespace:** [Unity.U2D.Physics](/engine/6000.7/script-reference/unity/u2d/physics.md)
* **Assembly:** UnityEngine.PhysicsCore2DModule

```csharp
public static int GetLayerOrdinal(string layerName)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The layer name (case sensitive) to find the layer ordinal for.

### Returns

| Type                                                       | Description                                                                                                                                                                                                                                                                      |
| ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The layer ordinal associated with the specified layer name or, if not found, [PhysicsLayers.InvalidLayerOrdinal](/engine/6000.7/script-reference/unity/u2d/physics/physicslayers/invalidlayerordinal.md) will be returned in which case a console warning will also be produced. |
