본문 바로가기

프로그래밍/Unity

[Unity] 인스펙터 변수 이름 변경

 

public class NameAttribute : PropertyAttribute
{
    public string NewName { get; private set; }
    public NameAttribute(string name)
    {
        NewName = name;
    }  
}



using UnityEditor;


public class NamePropertyDrawer : PropertyDrawer
{
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        NameAttribute nameAttribute = (NameAttribute)this.attribute;
        label.text = nameAttribute.NewName;
        EditorGUI.PropertyField(position, property, label );
    }
}



public class MyClass : MonoBehaviour
{
    [Name("테스트")
    public float testValue;
    
    .
    .
}

'프로그래밍 > Unity' 카테고리의 다른 글

[Unity] 테셀레이션  (0) 2019.04.05
[Unity] SteamVR 액션 설정  (0) 2018.11.05
[Unity] Post Process Stack v2  (0) 2018.10.31
[Unity] AR Foundation Package  (0) 2018.09.20
[Unity] 유니티용 DLL  (0) 2018.09.18
[Unity] VR 환경 끄거나 켜기  (0) 2018.09.14
[Unity] AssetDatabase  (0) 2018.09.12
[Unity] AssetBundle  (0) 2018.08.24
[unity3d] 서피스 쉐이더 정리  (1) 2018.06.26
[Unity] Mesh 생성 및 변경  (0) 2011.06.24