Объявление
public static int MaskField(GUIContent label, int mask, string[] displayedOptions, GUIStyle style, params GUILayoutOption[] options);public static int MaskField(string label, int mask, string[] displayedOptions, GUIStyle style, params GUILayoutOption[] options);
public static int MaskField(GUIContent label, int mask, string[] displayedOptions, params GUILayoutOption[] options);
public static int MaskField(string label, int mask, string[] displayedOptions, params GUILayoutOption[] options);
public static int MaskField(int mask, string[] displayedOptions, GUIStyle style, params GUILayoutOption[] options);
public static int MaskField(int mask, string[] displayedOptions, params GUILayoutOption[] options);
Параметры
label | Метка префикса поля. |
mask | Текущая маска для отображения. |
displayedOption | Массив строк, содержащий метки для каждого флага. |
options | Необязательный список параметров макета, определяющих дополнительные свойства макета. Любые переданные здесь значения переопределяют настройки, заданные стилем .Смотрите так же: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight. |
Возвращает
int Значение изменено пользователем.
Описание
Создаёт поле для масок.

using UnityEngine;
using UnityEditor;
public class MaskFieldExample : EditorWindow
{
static int flags = 0;
static string[] options = new string[] {"CanJump", "CanShoot", "CanSwim"};
[MenuItem("Examples/Mask Field usage")]
static void Init()
{
MaskFieldExample window = (MaskFieldExample)GetWindow(typeof(MaskFieldExample));
window.Show();
}
void OnGUI()
{
flags = EditorGUILayout.MaskField("Player Flags", flags, options);
}
}