Hi I don't know if there is a problem with GUI.Window or totaly my mistake when I want to create a window using the code below I always get the same window( same size/place - not where orhow it should be ). Code (csharp): var windowRect : Rect = Rect( 100, 100, 100, 200); function OnGUI(){ windowRect = GUI.Window (0, windowRect, DoMyWindow, "My Window"); } function DoMyWindow (windowID : int) { GUI.DragWindow (Rect (0,0,10000,10000)); if (GUI.Button (Rect (10,20,100,20), "Hello World")) print ("Got a click in window " + windowID); if (GUI.Button (Rect (10,40,100,20), "Hello World")) print ("Got a click in window " + windowID); } When I made the change below it-as it should- became un-draggable: Code (csharp): windowRect = GUI.Window (0, Rect( 100, 100, 200, 200 ), DoMyWindow, "My Window"); I just want a draggable big window with lots of stuff in it pls
Good Morning, with the code below in c# it works perfectly here you have the JavaScript lines. if you put the method "GUI.DragWindow ();" at the end the whole window you make will be draggable and you can never drag the window from outside it. function DoMyWindow (windowID : int) { GUI.Button (Rect (10,20,100,20), "Can't drag me"); GUI.DragWindow (); } If it doesn´t works here iam.
if you put this method GUI.DragWindow (); it gets the window size and its works, i tested in c# and works ok
Huh I tried write a simple unity scene with a simple javascript and it doens't work as well! Here my code: Code (csharp): function OnGUI() { var windowRect0 = Rect( 15, 100, 600, 200); var windowRect1 = Rect( 150, 100, 600, 400); windowRect1 = GUI.Window(0, windowRect1, ShowWindow2, "Good morning",GUI.skin.GetStyle("window") ); windowRect0 = GUI.Window(1, windowRect0, ShowWindow, "Good morning"); } function ShowWindow2(windowID : int) { GUI.Label( Rect( 20,75,410,60),"Hello world !!"); GUI.DragWindow(); } function ShowWindow(windowID : int) { GUI.Label( Rect( 20,75,410,60),"Hello world !!"); GUI.DragWindow(); } Both windows are not draggable...I can focus one or the other by clicking on them, but no dragging...why ?
@Litobyte: the reason the windows don't drag is that you are using local variables to store the rectangle returned from GUI.Window. The values need to persist between OnGUI calls, so you need to declare these variables outside the function.