- Home /
GUI controls inside a window are disabled for unknown reason
Hello,
My GUI controls are all disabled once I put them into my GUI window. Slider bar cannot slide, text field can not edit. If I copy the GUI control codes from inside the window to outside the window directly under the OnGUI(), every thing works again. Here is my code. Anyone knows the reason for this? Thanks in advance.
void OnGUI() {
GUI.skin = menuSkin;
windowRect = GUI.Window(0, windowRect,myWindow, "Menu", GUI.skin.GetStyle("Window"));
}
void myWindow(int windowID){
// GUI.DragWindow();
GUI.Box (box1, "Ambient Light");
GUI.Label(intensityRect, "Intensity");
mySlider = GUI.HorizontalSlider(IntensitySlider, mySlider,0.4f, 1.0f);
GUI.Box (box2, "Location Selection");
GUI.Button(buttonRoof, "Roof");
GUI.Button(buttonMecha, "Mechanical Room");
GUI.Box (box3, "Sun Track");
GUI.Label(azimuthLabel, "Azimuth");
azimuth = GUI.TextField(azimuthField, azimuth);
GUI.Label(altitudeLabel, "Altitude");
altitude = GUI.TextField(altitudeField, altitude);
}
Answer by Matt G · Feb 08, 2013 at 12:58 AM
The controls you use inside the Window Function are relative to the window itself. You might have positions or other variables set up to work in screen coordinates that don't make sense when they're relative to the window you're drawing them in.
Your answer
Follow this Question
Related Questions
Apply Render Texture To GUI + Transparency? 2 Answers
Please! How can i close a GUI-Wndows or Button in Javascript? 1 Answer
GUILayout Window not working inside switch case for conditional menu 1 Answer
Creating a FlightSim Like GUI HUD for Showing the player the angle of the Camera. 1 Answer
talking with a npc 0 Answers