该项目的目的是同时测试和演示来自 Unity DOTS 技术堆栈的多个新包。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

28 行
731 B

using System;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class EnumBitFieldAttribute : PropertyAttribute
{
public EnumBitFieldAttribute(Type enumType)
{
this.enumType = enumType;
}
public Type enumType;
}
#if UNITY_EDITOR
[CustomPropertyDrawer(typeof(EnumBitFieldAttribute))]
public class EnumBitFieldAttributeDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var enumFlagsAttribute = attribute as EnumBitFieldAttribute;
var names = Enum.GetNames(enumFlagsAttribute.enumType);
property.intValue = EditorGUI.MaskField(position, label, property.intValue, names);
}
}
#endif