확장을 편집하여 검사기 매개 변수의 이름을 단순화합니다.
등록 정보
CustomLabelAttribute.cs
using UnityEngine;
public class CustomLabelAttribute : PropertyAttribute
{
public readonly string Value;
public CustomLabelAttribute(string value)
{
Value = value;
}
}
편집기 측 코드
CustomLabelDrawer.cs
using UnityEditor;
using UnityEngine;
[CustomPropertyDrawer(typeof(CustomLabelAttribute))]
public class CustomLabelDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var newLabel = attribute as CustomLabelAttribute;
EditorGUI.PropertyField(position, property, new GUIContent(newLabel.Value), true);
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
return EditorGUI.GetPropertyHeight(property, true);
}
}
추기 2019/7/19Rect, 정렬 등 여러 줄 지원
사용자 코드 샘플
UseCustomLabelAttribute.cs
using UnityEngine;
public class UseCustomLabelAttribute : MonoBehaviour
{
[CustomLabel("カウント")]
public int Count;
}
적용 전
응용 후
항상 이름만 바꾸고 싶은 게 있어요.
유니티의 표준 기능이라 찾아도 찾을 수 없어서 했어요.
경쟁 같은 거 전혀 생각 안 했어요.
Reference
이 문제에 관하여(확장을 편집하여 검사기 매개 변수의 이름을 단순화합니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/Basuhei_Acheron/items/419f19d6532f1ffd3f33텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)