# GetMask

> Given a set of rendering layer names as defined in the Tags and Layers manager, returns the equivalent rendering layer mask for all of them.

## Definition

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

## GetMask(string\[])

Given a set of rendering layer names as defined in the [Tags and Layers manager](/engine/6000.0/manual/unity-editor/editor-settings-reference/comp-manager-group/class-tag-manager.md), returns the equivalent rendering layer mask for all of them.

```csharp
public static uint GetMask(params string[] renderingLayerNames)
```

### Parameters

**** (\[string\[]]\(https\://learn.microsoft.com/dotnet/api/system.string)): List of layer names to convert to a rendering layer mask.

### Returns

| Type                                                         | Description                                                    |
| ------------------------------------------------------------ | -------------------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | The rendering layer mask created from the renderingLayerNames. |

### Remarks

```csharp
using UnityEngine;
using UnityEngine.Rendering;

public class Example : MonoBehaviour
{
    void Start()
    {
        Debug.Log(RenderingLayerMask.GetMask("UserLayerA", "UserLayerB"));
    }
}
```

**Note:** Suppose UserLayerA and UserLayerB are the tenth and eleventh layers. These will have a Rendering Layer values of 10 and 11.  To obtain their layer mask value their names can be passed into [RenderingLayerMask.GetMask](/engine/6000.0/script-reference/unityengine/renderinglayermask/getmask.md).  The argument can either be a list of their names or an array of strings storing their names. In this case the return value will be 2^10 + 2^11 = 3072.

## GetMask(ReadOnlySpan\<string>)

Given a set of rendering layer names as defined in the [Tags and Layers manager](/engine/6000.0/manual/unity-editor/editor-settings-reference/comp-manager-group/class-tag-manager.md), returns the equivalent rendering layer mask for all of them.

```csharp
public static uint GetMask(ReadOnlySpan<string> renderingLayerNames)
```

### Parameters

**** (\[ReadOnlySpan\<string>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): Span of layer names to convert to a rendering layer mask.

### Returns

| Type                                                         | Description                                                    |
| ------------------------------------------------------------ | -------------------------------------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | The rendering layer mask created from the renderingLayerNames. |

### Examples

```csharp
using System;
using UnityEngine;
using UnityEngine.Rendering;

public class Example : MonoBehaviour
{
    [SerializeField] string[] renderingLayerNames = { "UserLayerA", "UserLayerB" };

    void Start()
    {
        Debug.Log(RenderingLayerMask.GetMask(new ReadOnlySpan<string>(renderingLayerNames)));
    }
}
```
