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?

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

Maybe a delegate?

private delegate void windowFunc();

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

GUILayout.Window(1, new Rect(100, 100, 500, 500), delegate { }, “ssdf” );