有些时候,想高效利用数据,把一个int(32位)掰成32个bool值。那么编辑器中有没有一个这样的插件支持呢?
以下是代码
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Reflection;
public enum MyEnum
{
Enum1 = 1,
Enum2 = 2,
}
public class MyEnumFieldName
{
public const string Enum1 = @"第一位";
public const string Enum2 = @"第一位";
}
public class BitMaskAttribute : PropertyAttribute
{
public BitMaskAttribute()
{
}
}
[CustomPropertyDrawer(typeof(BitMaskAttribute))]
public class BitMaskDrawer : PropertyDrawer
{
private float extraHeight = 20.0f;
private static bool showValues = true;
private bool hasError = false;
public string GetFieldName(string enumName)
{
string className = string.Format("{0}FieldName", this.fieldInfo.FieldType.Name);
Type classType = Type.GetType(className);
if (classType