Hi,
I’m currently making a customPropertyDrawer so a string will be look like an enum
in the inspector and you can choose one.
I made a subclass for a entity / method pair:
[System.Serializable]
public class EntityMethodPair {
public Entity target;
public string method;
}
When I try to make a propertyDrawer for it, it will look like this:
The code is:
[CustomPropertyDrawer (typeof (EntityMethodPair))]
public class EntityMethodDrawer : PropertyDrawer {
Entity obj = null;
public override void OnGUI (Rect pos, SerializedProperty prop, GUIContent label) {
SerializedProperty target = prop.FindPropertyRelative ("target");
SerializedProperty method = prop.FindPropertyRelative ("method");
EditorGUI.BeginChangeCheck();
obj = (Entity)EditorGUI.ObjectField (pos, "target", obj, typeof(Entity));
// 2nd line
Rect ExtraPosition = EditorGUI.IndentedRect(pos);
ExtraPosition.y += 16;
ExtraPosition.height = 16+5;
// draw popup list
string[] methods = {"A", "B"};
EditorGUI.Popup(ExtraPosition,"method", 0, method);
}
}
Now how can i get a 2nd line in there?