GUI buttons not showing up

Hi all!

Trying to get a list of all cameras in the scene and represent them as a GUI button, and by pressing a button will be able to switch camera.

I am on the stage of trying to get the list on the screen at all.


if (GUI.Button(Rect (btnX*2.4, btnY * 1.05 + (btnH /2) , btnH, btnW),"Update Camera list")) {
	 cameras = FindObjectsOfType(Camera);
	                          	
  if (cameras) {
	for (i=0; i<cameras.length; i++) {
		if (GUI.Button(Rect(btnX * 2.3 + btnW, btnY * 1.2 + (btnH * i), btnW * 3, btnH * 0.5), cameras*.name)) {*

// Insert Camera Switching Code Here
}
}
}
}
----------
No luck so far. If you could help me to get the GUI working and it would be super if you could give med the actual line of code needed to be able to switch the present camera for the one corresponding to the buttonpress.
Thanks in advance.

for switching you should disable the current camera and enable the clicked one and store the new one as current in a static variable.
The problem is that you’ll find cameras and put them in a list when a buton is clicked and that’s only a frame and in all other times the cameras variable is null and would if would return false as result of it. If cameras is a variable in file scope and not only inside this function then this is not the problem however.
But if i’m correct define var cameras in top of your code file.
Do you see the main button UpdateCameraList ?