- Home /
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?
Answer by poncho · Jan 04, 2011 at 03:54 PM
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
Answer by fireDude67 · Jan 04, 2011 at 03:58 PM
Maybe a delegate?
private delegate void windowFunc();
void Start() { windowFunc = func(); } void func() { / This is the function you put your code in / }
Answer by John Morgan · Jun 09, 2013 at 05:37 PM
GUILayout.Window(1, new Rect(100, 100, 500, 500), delegate { }, "ssdf" );
Your answer
Follow this Question
Related Questions
What's a great way to make a custom information window pop up 1 Answer
GUI Rotation 1 Answer
Don't show window close button 1 Answer
GUI.Window only shows for one frame under all circumstances 2 Answers
How to make multiple GUI window? 1 Answer