If I use this:
using UnityEngine;
using System.Collections;
public class GUIcode : MonoBehaviour {
public Rect windowRect = new Rect(20, 20, 500, 500);
void OnGUI()
{
windowRect = GUILayout.Window(0, windowRect, DoMyWindow, "My Window");
}
void DoMyWindow(int windowID)
{
GUI.DragWindow(new Rect(0, 0, 10000, 20));
GUILayout.Label("This is a label");
GUILayout.Label("Another label");
GUILayout.HorizontalSlider(500, 0, 1000);
}
}
I get a nice Window.
But if I add GUILayout.BeginArea (and End) functions, the window shrinks to a dot:
using UnityEngine;
using System.Collections;
public class GUIcode : MonoBehaviour {
public Rect windowRect = new Rect(20, 20, 500, 500);
void OnGUI()
{
windowRect = GUILayout.Window(0, windowRect, DoMyWindow, "My Window");
}
void DoMyWindow(int windowID)
{
GUI.DragWindow(new Rect(0, 0, 10000, 20));
GUILayout.BeginArea(new Rect(10,10,200,200));
GUILayout.Label("This is a label");
GUILayout.Label("Another label");
GUILayout.HorizontalSlider(500, 0, 1000);
GUILayout.EndArea();
}
}
Is this a bug or am I doing something wrong?