- Home /
GUI.Window is not resizing properly when resolution is being changed
Hello could you please tell me why my GUI.Window is working in kind of a funny way ?
I declared my window as
private var _inventoryWindowRect : Rect = new Rect(35,150,Screen.width / 2.25, Screen.height / 2.45);
and when i am in Unity and i have Maximize on Play ON, my window is working just fine even when i am changing resolutions from free aspect to 4:3 or 1024/768 etc, etc. The problem occurs when i have Maximize on Play OFF and when i click Play my window is not resizing at all and it is like half of the original size. So i have to quit Play mode and, play it again close it and then turn on Maximize on Play and then it is working again. Sometimes i have to do the exact opposite as stated before to make my make window to be right size. Also when i am on different computer with bigger screen then i have at home i have to resize my window again in order to make it work on the bigger screen.
First i tried hard coded size values but i was having the same problem like now.
Could you please give me an advice how to make my window to be always the same size no matter what resolution i have on.
This is really annoying and i want to have it sorted, but the bloody window is just refusing to cooperate.
PS: the size of my GUI.Buttons inside my inventory window is 40, if it's any help to you.
Answer by TrewSx · Apr 24, 2013 at 11:00 AM
Well i tried to use hard coded values it seems to work for me so the GUI.WIndow is now like this
private var _inventoryWindowRect : Rect = new Rect(35,150,500, 250);