public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { RenameAttribute rename = (RenameAttribute)attribute; label.text = rename.mName; EditorGUI.PropertyField(position, property, label); }
static string GetItemAttributeText(Type attributeType, Type itemType, RenameAttribute renameRule) { string originalItemTypeName = itemType.GetNonGenericName(); string xmlItemTypeName = renameRule != null ? renameRule.Rename(originalItemTypeName) : originalItemTypeName; return new AttributeBuilder(attributeType.FullName) .AddStringParam(xmlItemTypeName) .AddTypeParam(originalItemTypeName) .ToString(); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { //替换属性名称 RenameAttribute rename = (RenameAttribute)attribute; label.text = rename.name; //重绘GUI SerializedPropertyType type = property.propertyType; if (type == SerializedPropertyType.Enum) { redrawEnums(position, property, label); } else { EditorGUI.PropertyField(position, property, label); } }