- Home /
Using treeview OnGUI with GUIlayout
I'm trying to display a treeview in an editor window GUI where I'm using GUIlayout for positioning.
Current Code:
void OnGUI()
{
// Menu
GUILayout.BeginHorizontal(EditorStyles.toolbar);
DrawToolStrip();
GUILayout.EndHorizontal();
GUILayout.BeginScrollView(scrollPos);
DrawMain();
GUILayout.EndScrollView();
}
void DrawMain()
{
Rect test = GUILayoutUtility.GetLastRect();
Rect again = new Rect(0, 0, test.width, test.height);
fileTreeView.OnGUI(again);
}
But i cant get it to display as GetLastRect returns NullReference exception. How would i make this display in a layout keeping scaled to the current layout container.
Comment