x


GUI.Window function with variables?

I am using GUILayout.Window and my code is as follows:

windowRect = GUILayout.Window(0,windowRect,windowFunc,"The Title");

My question is there, I have been trying to pass the function part of the gui window code to all for variables to be passed into that function, is that possible?

more ▼

asked Jan 04 '11 at 03:23 PM

mimatos gravatar image

mimatos
129 12 13 15

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

if you mean using your windowFunc outside the OnGUI function, yes you can as long it is declared out side the funcion

Rect windowRect;
GUI.WindowFunction windowFunc;

void OnGUI()
{
windowRect = GUI.Window(0, windowRect, windowFunc, "The Title");
}

if this is not what you are lookin then you can or if you are using it inside the OnGUI function then the GUI.WindowFunction can be inside the OnGUI, on both it will work

hope this helps

more ▼

answered Jan 04 '11 at 03:54 PM

poncho gravatar image

poncho
932 2 3 14

(comments are locked)
10|3000 characters needed characters left

Maybe a delegate?

private delegate void windowFunc();

void Start() { windowFunc = func(); }
void func() { /* This is the function you put your code in */ }
more ▼

answered Jan 04 '11 at 03:58 PM

fireDude67 gravatar image

fireDude67
945 9 15 30

(comments are locked)
10|3000 characters needed characters left
GUILayout.Window(1, new Rect(100, 100, 500, 500), delegate { }, "ssdf" );
more ▼

answered Jun 09 at 05:37 PM

John Morgan gravatar image

John Morgan
1 1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3817
x499
x208

asked: Jan 04 '11 at 03:23 PM

Seen: 1164 times

Last Updated: Jun 09 at 05:37 PM