# EnumMaskField

> This method is obsolete. Use EditorGUILayout.EnumFlagsField instead. Make a field for enum based masks.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.0/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

## EnumMaskField(Enum, GUILayoutOption\[])

This method is obsolete. Use [EditorGUILayout.EnumFlagsField](/engine/6000.0/script-reference/unityeditor/editorguilayout/enumflagsfield.md) instead.

Make a field for enum based masks.

> **Warning:**
>
> **Deprecated.** EnumMaskField has been deprecated. Use EnumFlagsField instead.

```csharp
public static Enum EnumMaskField(Enum enumValue, params GUILayoutOption[] options)
```

### Parameters

**** (\[Enum]\(https\://learn.microsoft.com/dotnet/api/system.enum)): Enum to use for the flags.**** (\[GUILayoutOption\[]]\(/engine/6000.0/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.0/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.0/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.0/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.0/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.0/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.0/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.0/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.0/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                       | Description                     |
| ---------------------------------------------------------- | ------------------------------- |
| [Enum](https://learn.microsoft.com/dotnet/api/system.enum) | The value modified by the user. |

### Remarks

Additional Resources: [EditorGUILayout.EnumFlagsField](/engine/6000.0/script-reference/unityeditor/editorguilayout/enumflagsfield.md).

![MaskField (EnumMaskField)](/api/media?file=/engine/6000.0/media/images/MaskField.png)

*Simple window that shows the enum mask field.* Here is an example of how to implement an EnumMaskField, giving three options:

```csharp
using UnityEngine;
using UnityEditor;

public class EditorEnumExample : EditorWindow
{
    public enum Example
    {
        Option_One = 1, //bits: 0000 0001
        Option_Two = 2,  //bits: 0000 0010
        Option_Three = 4     //bits: 0000 0100
    }

    Example   staticFlagMask = 0;


    [MenuItem("Examples/Mask Field Usage")]
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        EditorEnumExample window = (EditorEnumExample)EditorWindow.GetWindow(typeof(EditorEnumExample));
        window.Show();
    }

    void OnGUI()
    {
        staticFlagMask = (Example)EditorGUILayout.EnumMaskField("Static Flags", staticFlagMask);
    }
}
```

Internally, Unity stores the enum as an int, with each value as a bitmask. Selecting "Nothing" clears all bits, resulting in an integer value of 0; selecting "Everything" will set all bits, producing an integer value of -1.

To determine whether a particular enum value has been set, you can either treat the enum as an int and perform a bitwise OR to test, or you can unset the "Everything" value by iterating through the enum values and reconstructing the enum accordingly. An example of how to do this is shown below:

```csharp
using UnityEngine;
using UnityEditor;

public class EditorEnumExample : EditorWindow
{
    public enum Example
    {
        Option_One = 1, //bits: 0000 0001
        Option_Two = 2,  //bits: 0000 0010
        Option_Three = 4     //bits: 0000 0100
    }

    Example   staticFlagMask = 0;


    [MenuItem("Examples/Mask Field Usage")]
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        EditorEnumExample window = (EditorEnumExample)EditorWindow.GetWindow(typeof(EditorEnumExample));
        window.Show();
    }

    void OnGUI()
    {
        staticFlagMask = (Example)EditorGUILayout.EnumMaskField("Static Flags", staticFlagMask);

        // If "Everything" is set, force Unity to unset the extra bits by iterating through them
        if ((int)staticFlagMask < 0)
        {
            int bits = 0;
            foreach (var enumValue in System.Enum.GetValues(typeof(Example)))
            {
                int checkBit = (int)staticFlagMask & (int)enumValue;
                if (checkBit != 0)
                    bits |= (int)enumValue;
            }

            staticFlagMask = (Example)bits;
        }
    }
}
```

## EnumMaskField(Enum, GUIStyle, GUILayoutOption\[])

This method is obsolete. Use [EditorGUILayout.EnumFlagsField](/engine/6000.0/script-reference/unityeditor/editorguilayout/enumflagsfield.md) instead.

Make a field for enum based masks.

> **Warning:**
>
> **Deprecated.** EnumMaskField has been deprecated. Use EnumFlagsField instead.

```csharp
public static Enum EnumMaskField(Enum enumValue, GUIStyle style, params GUILayoutOption[] options)
```

### Parameters

**** (\[Enum]\(https\://learn.microsoft.com/dotnet/api/system.enum)): Enum to use for the flags.**** (\[GUIStyle]\(/engine/6000.0/script-reference/unityengine/guistyle)): Optional [GUIStyle](/engine/6000.0/script-reference/unityengine/guistyle.md).**** (\[GUILayoutOption\[]]\(/engine/6000.0/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.0/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.0/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.0/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.0/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.0/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.0/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.0/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.0/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                       | Description                     |
| ---------------------------------------------------------- | ------------------------------- |
| [Enum](https://learn.microsoft.com/dotnet/api/system.enum) | The value modified by the user. |

### Remarks

Additional Resources: [EditorGUILayout.EnumFlagsField](/engine/6000.0/script-reference/unityeditor/editorguilayout/enumflagsfield.md).

![MaskField (EnumMaskField)](/api/media?file=/engine/6000.0/media/images/MaskField.png)

*Simple window that shows the enum mask field.* Here is an example of how to implement an EnumMaskField, giving three options:

```csharp
using UnityEngine;
using UnityEditor;

public class EditorEnumExample : EditorWindow
{
    public enum Example
    {
        Option_One = 1, //bits: 0000 0001
        Option_Two = 2,  //bits: 0000 0010
        Option_Three = 4     //bits: 0000 0100
    }

    Example   staticFlagMask = 0;


    [MenuItem("Examples/Mask Field Usage")]
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        EditorEnumExample window = (EditorEnumExample)EditorWindow.GetWindow(typeof(EditorEnumExample));
        window.Show();
    }

    void OnGUI()
    {
        staticFlagMask = (Example)EditorGUILayout.EnumMaskField("Static Flags", staticFlagMask);
    }
}
```

Internally, Unity stores the enum as an int, with each value as a bitmask. Selecting "Nothing" clears all bits, resulting in an integer value of 0; selecting "Everything" will set all bits, producing an integer value of -1.

To determine whether a particular enum value has been set, you can either treat the enum as an int and perform a bitwise OR to test, or you can unset the "Everything" value by iterating through the enum values and reconstructing the enum accordingly. An example of how to do this is shown below:

```csharp
using UnityEngine;
using UnityEditor;

public class EditorEnumExample : EditorWindow
{
    public enum Example
    {
        Option_One = 1, //bits: 0000 0001
        Option_Two = 2,  //bits: 0000 0010
        Option_Three = 4     //bits: 0000 0100
    }

    Example   staticFlagMask = 0;


    [MenuItem("Examples/Mask Field Usage")]
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        EditorEnumExample window = (EditorEnumExample)EditorWindow.GetWindow(typeof(EditorEnumExample));
        window.Show();
    }

    void OnGUI()
    {
        staticFlagMask = (Example)EditorGUILayout.EnumMaskField("Static Flags", staticFlagMask);

        // If "Everything" is set, force Unity to unset the extra bits by iterating through them
        if ((int)staticFlagMask < 0)
        {
            int bits = 0;
            foreach (var enumValue in System.Enum.GetValues(typeof(Example)))
            {
                int checkBit = (int)staticFlagMask & (int)enumValue;
                if (checkBit != 0)
                    bits |= (int)enumValue;
            }

            staticFlagMask = (Example)bits;
        }
    }
}
```

## EnumMaskField(string, Enum, GUILayoutOption\[])

This method is obsolete. Use [EditorGUILayout.EnumFlagsField](/engine/6000.0/script-reference/unityeditor/editorguilayout/enumflagsfield.md) instead.

Make a field for enum based masks.

> **Warning:**
>
> **Deprecated.** EnumMaskField has been deprecated. Use EnumFlagsField instead.

```csharp
public static Enum EnumMaskField(string label, Enum enumValue, params GUILayoutOption[] options)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Prefix label for this field.**** (\[Enum]\(https\://learn.microsoft.com/dotnet/api/system.enum)): Enum to use for the flags.**** (\[GUILayoutOption\[]]\(/engine/6000.0/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.0/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.0/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.0/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.0/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.0/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.0/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.0/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.0/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                       | Description                     |
| ---------------------------------------------------------- | ------------------------------- |
| [Enum](https://learn.microsoft.com/dotnet/api/system.enum) | The value modified by the user. |

### Remarks

Additional Resources: [EditorGUILayout.EnumFlagsField](/engine/6000.0/script-reference/unityeditor/editorguilayout/enumflagsfield.md).

![MaskField (EnumMaskField)](/api/media?file=/engine/6000.0/media/images/MaskField.png)

*Simple window that shows the enum mask field.* Here is an example of how to implement an EnumMaskField, giving three options:

```csharp
using UnityEngine;
using UnityEditor;

public class EditorEnumExample : EditorWindow
{
    public enum Example
    {
        Option_One = 1, //bits: 0000 0001
        Option_Two = 2,  //bits: 0000 0010
        Option_Three = 4     //bits: 0000 0100
    }

    Example   staticFlagMask = 0;


    [MenuItem("Examples/Mask Field Usage")]
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        EditorEnumExample window = (EditorEnumExample)EditorWindow.GetWindow(typeof(EditorEnumExample));
        window.Show();
    }

    void OnGUI()
    {
        staticFlagMask = (Example)EditorGUILayout.EnumMaskField("Static Flags", staticFlagMask);
    }
}
```

Internally, Unity stores the enum as an int, with each value as a bitmask. Selecting "Nothing" clears all bits, resulting in an integer value of 0; selecting "Everything" will set all bits, producing an integer value of -1.

To determine whether a particular enum value has been set, you can either treat the enum as an int and perform a bitwise OR to test, or you can unset the "Everything" value by iterating through the enum values and reconstructing the enum accordingly. An example of how to do this is shown below:

```csharp
using UnityEngine;
using UnityEditor;

public class EditorEnumExample : EditorWindow
{
    public enum Example
    {
        Option_One = 1, //bits: 0000 0001
        Option_Two = 2,  //bits: 0000 0010
        Option_Three = 4     //bits: 0000 0100
    }

    Example   staticFlagMask = 0;


    [MenuItem("Examples/Mask Field Usage")]
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        EditorEnumExample window = (EditorEnumExample)EditorWindow.GetWindow(typeof(EditorEnumExample));
        window.Show();
    }

    void OnGUI()
    {
        staticFlagMask = (Example)EditorGUILayout.EnumMaskField("Static Flags", staticFlagMask);

        // If "Everything" is set, force Unity to unset the extra bits by iterating through them
        if ((int)staticFlagMask < 0)
        {
            int bits = 0;
            foreach (var enumValue in System.Enum.GetValues(typeof(Example)))
            {
                int checkBit = (int)staticFlagMask & (int)enumValue;
                if (checkBit != 0)
                    bits |= (int)enumValue;
            }

            staticFlagMask = (Example)bits;
        }
    }
}
```

## EnumMaskField(string, Enum, GUIStyle, GUILayoutOption\[])

This method is obsolete. Use [EditorGUILayout.EnumFlagsField](/engine/6000.0/script-reference/unityeditor/editorguilayout/enumflagsfield.md) instead.

Make a field for enum based masks.

> **Warning:**
>
> **Deprecated.** EnumMaskField has been deprecated. Use EnumFlagsField instead.

```csharp
public static Enum EnumMaskField(string label, Enum enumValue, GUIStyle style, params GUILayoutOption[] options)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Prefix label for this field.**** (\[Enum]\(https\://learn.microsoft.com/dotnet/api/system.enum)): Enum to use for the flags.**** (\[GUIStyle]\(/engine/6000.0/script-reference/unityengine/guistyle)): Optional [GUIStyle](/engine/6000.0/script-reference/unityengine/guistyle.md).**** (\[GUILayoutOption\[]]\(/engine/6000.0/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.0/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.0/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.0/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.0/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.0/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.0/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.0/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.0/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                       | Description                     |
| ---------------------------------------------------------- | ------------------------------- |
| [Enum](https://learn.microsoft.com/dotnet/api/system.enum) | The value modified by the user. |

### Remarks

Additional Resources: [EditorGUILayout.EnumFlagsField](/engine/6000.0/script-reference/unityeditor/editorguilayout/enumflagsfield.md).

![MaskField (EnumMaskField)](/api/media?file=/engine/6000.0/media/images/MaskField.png)

*Simple window that shows the enum mask field.* Here is an example of how to implement an EnumMaskField, giving three options:

```csharp
using UnityEngine;
using UnityEditor;

public class EditorEnumExample : EditorWindow
{
    public enum Example
    {
        Option_One = 1, //bits: 0000 0001
        Option_Two = 2,  //bits: 0000 0010
        Option_Three = 4     //bits: 0000 0100
    }

    Example   staticFlagMask = 0;


    [MenuItem("Examples/Mask Field Usage")]
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        EditorEnumExample window = (EditorEnumExample)EditorWindow.GetWindow(typeof(EditorEnumExample));
        window.Show();
    }

    void OnGUI()
    {
        staticFlagMask = (Example)EditorGUILayout.EnumMaskField("Static Flags", staticFlagMask);
    }
}
```

Internally, Unity stores the enum as an int, with each value as a bitmask. Selecting "Nothing" clears all bits, resulting in an integer value of 0; selecting "Everything" will set all bits, producing an integer value of -1.

To determine whether a particular enum value has been set, you can either treat the enum as an int and perform a bitwise OR to test, or you can unset the "Everything" value by iterating through the enum values and reconstructing the enum accordingly. An example of how to do this is shown below:

```csharp
using UnityEngine;
using UnityEditor;

public class EditorEnumExample : EditorWindow
{
    public enum Example
    {
        Option_One = 1, //bits: 0000 0001
        Option_Two = 2,  //bits: 0000 0010
        Option_Three = 4     //bits: 0000 0100
    }

    Example   staticFlagMask = 0;


    [MenuItem("Examples/Mask Field Usage")]
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        EditorEnumExample window = (EditorEnumExample)EditorWindow.GetWindow(typeof(EditorEnumExample));
        window.Show();
    }

    void OnGUI()
    {
        staticFlagMask = (Example)EditorGUILayout.EnumMaskField("Static Flags", staticFlagMask);

        // If "Everything" is set, force Unity to unset the extra bits by iterating through them
        if ((int)staticFlagMask < 0)
        {
            int bits = 0;
            foreach (var enumValue in System.Enum.GetValues(typeof(Example)))
            {
                int checkBit = (int)staticFlagMask & (int)enumValue;
                if (checkBit != 0)
                    bits |= (int)enumValue;
            }

            staticFlagMask = (Example)bits;
        }
    }
}
```

## EnumMaskField(GUIContent, Enum, GUILayoutOption\[])

This method is obsolete. Use [EditorGUILayout.EnumFlagsField](/engine/6000.0/script-reference/unityeditor/editorguilayout/enumflagsfield.md) instead.

Make a field for enum based masks.

> **Warning:**
>
> **Deprecated.** EnumMaskField has been deprecated. Use EnumFlagsField instead.

```csharp
public static Enum EnumMaskField(GUIContent label, Enum enumValue, params GUILayoutOption[] options)
```

### Parameters

**** (\[GUIContent]\(/engine/6000.0/script-reference/unityengine/guicontent)): Prefix label for this field.**** (\[Enum]\(https\://learn.microsoft.com/dotnet/api/system.enum)): Enum to use for the flags.**** (\[GUILayoutOption\[]]\(/engine/6000.0/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.0/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.0/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.0/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.0/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.0/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.0/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.0/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.0/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                       | Description                     |
| ---------------------------------------------------------- | ------------------------------- |
| [Enum](https://learn.microsoft.com/dotnet/api/system.enum) | The value modified by the user. |

### Remarks

Additional Resources: [EditorGUILayout.EnumFlagsField](/engine/6000.0/script-reference/unityeditor/editorguilayout/enumflagsfield.md).

![MaskField (EnumMaskField)](/api/media?file=/engine/6000.0/media/images/MaskField.png)

*Simple window that shows the enum mask field.* Here is an example of how to implement an EnumMaskField, giving three options:

```csharp
using UnityEngine;
using UnityEditor;

public class EditorEnumExample : EditorWindow
{
    public enum Example
    {
        Option_One = 1, //bits: 0000 0001
        Option_Two = 2,  //bits: 0000 0010
        Option_Three = 4     //bits: 0000 0100
    }

    Example   staticFlagMask = 0;


    [MenuItem("Examples/Mask Field Usage")]
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        EditorEnumExample window = (EditorEnumExample)EditorWindow.GetWindow(typeof(EditorEnumExample));
        window.Show();
    }

    void OnGUI()
    {
        staticFlagMask = (Example)EditorGUILayout.EnumMaskField("Static Flags", staticFlagMask);
    }
}
```

Internally, Unity stores the enum as an int, with each value as a bitmask. Selecting "Nothing" clears all bits, resulting in an integer value of 0; selecting "Everything" will set all bits, producing an integer value of -1.

To determine whether a particular enum value has been set, you can either treat the enum as an int and perform a bitwise OR to test, or you can unset the "Everything" value by iterating through the enum values and reconstructing the enum accordingly. An example of how to do this is shown below:

```csharp
using UnityEngine;
using UnityEditor;

public class EditorEnumExample : EditorWindow
{
    public enum Example
    {
        Option_One = 1, //bits: 0000 0001
        Option_Two = 2,  //bits: 0000 0010
        Option_Three = 4     //bits: 0000 0100
    }

    Example   staticFlagMask = 0;


    [MenuItem("Examples/Mask Field Usage")]
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        EditorEnumExample window = (EditorEnumExample)EditorWindow.GetWindow(typeof(EditorEnumExample));
        window.Show();
    }

    void OnGUI()
    {
        staticFlagMask = (Example)EditorGUILayout.EnumMaskField("Static Flags", staticFlagMask);

        // If "Everything" is set, force Unity to unset the extra bits by iterating through them
        if ((int)staticFlagMask < 0)
        {
            int bits = 0;
            foreach (var enumValue in System.Enum.GetValues(typeof(Example)))
            {
                int checkBit = (int)staticFlagMask & (int)enumValue;
                if (checkBit != 0)
                    bits |= (int)enumValue;
            }

            staticFlagMask = (Example)bits;
        }
    }
}
```

## EnumMaskField(GUIContent, Enum, GUIStyle, GUILayoutOption\[])

This method is obsolete. Use [EditorGUILayout.EnumFlagsField](/engine/6000.0/script-reference/unityeditor/editorguilayout/enumflagsfield.md) instead.

Make a field for enum based masks.

> **Warning:**
>
> **Deprecated.** EnumMaskField has been deprecated. Use EnumFlagsField instead.

```csharp
public static Enum EnumMaskField(GUIContent label, Enum enumValue, GUIStyle style, params GUILayoutOption[] options)
```

### Parameters

**** (\[GUIContent]\(/engine/6000.0/script-reference/unityengine/guicontent)): Prefix label for this field.**** (\[Enum]\(https\://learn.microsoft.com/dotnet/api/system.enum)): Enum to use for the flags.**** (\[GUIStyle]\(/engine/6000.0/script-reference/unityengine/guistyle)): Optional [GUIStyle](/engine/6000.0/script-reference/unityengine/guistyle.md).**** (\[GUILayoutOption\[]]\(/engine/6000.0/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.0/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.0/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.0/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.0/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.0/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.0/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.0/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.0/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                       | Description                     |
| ---------------------------------------------------------- | ------------------------------- |
| [Enum](https://learn.microsoft.com/dotnet/api/system.enum) | The value modified by the user. |

### Remarks

Additional Resources: [EditorGUILayout.EnumFlagsField](/engine/6000.0/script-reference/unityeditor/editorguilayout/enumflagsfield.md).

![MaskField (EnumMaskField)](/api/media?file=/engine/6000.0/media/images/MaskField.png)

*Simple window that shows the enum mask field.* Here is an example of how to implement an EnumMaskField, giving three options:

```csharp
using UnityEngine;
using UnityEditor;

public class EditorEnumExample : EditorWindow
{
    public enum Example
    {
        Option_One = 1, //bits: 0000 0001
        Option_Two = 2,  //bits: 0000 0010
        Option_Three = 4     //bits: 0000 0100
    }

    Example   staticFlagMask = 0;


    [MenuItem("Examples/Mask Field Usage")]
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        EditorEnumExample window = (EditorEnumExample)EditorWindow.GetWindow(typeof(EditorEnumExample));
        window.Show();
    }

    void OnGUI()
    {
        staticFlagMask = (Example)EditorGUILayout.EnumMaskField("Static Flags", staticFlagMask);
    }
}
```

Internally, Unity stores the enum as an int, with each value as a bitmask. Selecting "Nothing" clears all bits, resulting in an integer value of 0; selecting "Everything" will set all bits, producing an integer value of -1.

To determine whether a particular enum value has been set, you can either treat the enum as an int and perform a bitwise OR to test, or you can unset the "Everything" value by iterating through the enum values and reconstructing the enum accordingly. An example of how to do this is shown below:

```csharp
using UnityEngine;
using UnityEditor;

public class EditorEnumExample : EditorWindow
{
    public enum Example
    {
        Option_One = 1, //bits: 0000 0001
        Option_Two = 2,  //bits: 0000 0010
        Option_Three = 4     //bits: 0000 0100
    }

    Example   staticFlagMask = 0;


    [MenuItem("Examples/Mask Field Usage")]
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        EditorEnumExample window = (EditorEnumExample)EditorWindow.GetWindow(typeof(EditorEnumExample));
        window.Show();
    }

    void OnGUI()
    {
        staticFlagMask = (Example)EditorGUILayout.EnumMaskField("Static Flags", staticFlagMask);

        // If "Everything" is set, force Unity to unset the extra bits by iterating through them
        if ((int)staticFlagMask < 0)
        {
            int bits = 0;
            foreach (var enumValue in System.Enum.GetValues(typeof(Example)))
            {
                int checkBit = (int)staticFlagMask & (int)enumValue;
                if (checkBit != 0)
                    bits |= (int)enumValue;
            }

            staticFlagMask = (Example)bits;
        }
    }
}
```
