# NameToID(string)

> Returns the id given the name. Will return 0 if an invalid name was given.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public static int NameToID(string name)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the layer.

### Returns

| Type                                                       | Description                                     |
| ---------------------------------------------------------- | ----------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | Returns the unique id of the layer with `name`. |
