I tried to do it here
but not work, i make a script :
NamedArrayAttribute:
using UnityEngine;
public class NamedArrayAttribute : PropertyAttribute
{
public readonly string[] names;
public NamedArrayAttribute(string[] names) { this.names = names; }
}
PropertyDrawer:
using UnityEngine;
using UnityEditor;
[CustomPropertyDrawer (typeof(NamedArrayAttribute))]public class NamedArrayDrawer : PropertyDrawer
{
public override void OnGUI(Rect rect, SerializedProperty property, GUIContent label)
{
try {
int pos = int.Parse(property.propertyPath.Split('[', ']')[1]);
EditorGUI.ObjectField(rect, property, new GUIContent(((NamedArrayAttribute)attribute).names[pos]));
} catch {
EditorGUI.ObjectField(rect, property, label);
}
}
}
but namespace name “NamedArrayAttribute” could not be found