Hello,everyone. I wanna to draw a window with some other controls in it using GUILayout.Window, But i can not control the window’s size, for it is a little small for my application after GUILayout calculate its size, Here is part of the code:
public int _wndWidth = 450;
public int _wndHeight = 420;
private Rect _rectWnd;
void Start()
{
_rectWnd = new Rect(Screen.width * 0.5f - _wndWidth * 0.5f, Screen.height * 0.5f - _wndHeight * 0.5f, _wndWidth, _wndHeight);
}
void OnGUI
{
_rectWnd = GUILayout.Window(GlobalGUIWindowId._WND1_YXY, _rectWnd, ShowParamsWnd, _wndTitle, _guiSkin.window, GUILayout.MinWidth(_wndWidth), GUILayout.MinHeight(_wndHeight));
}
private void ShowParamsWnd(int id)
{
//some other controls.
}
the final effect is below:
125
125
How to control the window’s size, i want to enlarge it. Thanks in advance!
Cool, didn't realise GUILayoutOptions were also possible for Windows. I always directly altered the returned Rect.
– anon73820239