Rasagar/Library/PackageCache/com.unity.visualeffectgraph/Editor/Utilities/ExposedProperty/ExposedPropertyDrawer.cs

24 lines
823 B
C#
Raw Normal View History

2024-08-26 13:07:20 -07:00
using UnityEditor.UIElements;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.VFX.Utility;
namespace UnityEditor.VFX.Utility
{
[CustomPropertyDrawer(typeof(ExposedProperty))]
class ExposedPropertyDrawer : PropertyDrawer
{
const string k_PropertyName = "m_Name";
public override VisualElement CreatePropertyGUI(SerializedProperty property)
{
return new PropertyField(property.FindPropertyRelative(k_PropertyName), ObjectNames.NicifyVariableName(property.name));
}
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.PropertyField(position, property.FindPropertyRelative(k_PropertyName), new GUIContent(ObjectNames.NicifyVariableName(property.name)));
}
}
}