I implemented this, but it never appears to call my code at all.
The button on the blackboard variables window appears as before, but when the popup window opens the debug log doesn’t get called and the button doesn’t show. I tried putting the class in both a folder called Editor and a normal game folder ( not at the same time of course!) but neither one appeared to work.
public class StateFlagObjectDrawer : ObjectDrawer<StateFlagRef>
{
static string NO_FLAG_STR = “”;
bool open = false;
public override StateFlagRef OnGUI(GUIContent content, StateFlagRef flagRef)
{
if (GUILayout.Button(“OK”))
{
Debug.Log(“OK”);
}
Debug.Log(“my drawer”);
}
return flagRef;
}
(Not sure how to insert code on this forum, so apologies for any bad formatting!)
Update: On further debugging, when the code gets to EditorUtils::ReflectedFieldInspector for the variable of this class type, the parameters for field and attributes are both null, preventing it from finding the new drawer type, and instead reverting to the default drawer. Am I missing an attribute to get this to work?