Offical example code:
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
index = EditorGUILayout.Popup(index, options);
}
If you want to update property value after select:
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
int index = Array.IndexOf(options, property.objectReferenceValue);
if (index!= -1)
{
index = EditorGUI.Popup(position, label.text, index, options);
property.objectReferenceValue = options[index];
}
}
Top comments (0)