I'm writing a custom editor window for dialogue trees. That has a series of nodes to represent lines of dialogue.
I want to have a button inside these Node Windows that calls a function. The button is, however, unresponsive and I can't figure out why.
Here's the code from OnGUI in the EditorWindow class that draws all of the nodes (they're in a scroll area):
GUILayout.BeginVertical();
{
scrollPos = GUI.BeginScrollView(new Rect(0f, scrollViewYStartPos, position.width, position.height-110f), scrollPos, new Rect(0, 0, 10000, 10000));
{
BeginWindows();
for (int i = 0; i < dialogues.Count; i++)
dialogues[i].windowRect = GUILayout.Window(i, dialogues[i].windowRect, DrawNodeWindow, dialogues[i].windowTitle);
EndWindows();
}
GUI.EndScrollView();
}
GUILayout.EndVertical();
The node windows are created within the BeginWindows and EndWindows. The function to create them is:
private static void DrawNodeWindow(int id)
{
dialogues[id].DrawWindow();
}
And the code in the actual node that defines its display is:
public virtual void DrawWindow()
{
if (GUI.Button(new Rect(windowRect.width - 44f, 1f, 36f, 14f), "Size"))
{
ChangeWindowHeight();
}
}
^That's the button that isn't responding though. It just seems to get stuck when I press it.
Any help would be appreciated!
Thanks,
Matt
↧