- Home /
Question by
OverGast · Aug 08, 2015 at 10:34 AM ·
unity 5javascriptgui
GUI.Box NullReferenceException
Hi all, im trying to do an Option Menu with a GUI using Box, Button and more. The problem is that when i put the box on the code (in JavaScript) i receive the weird error of NullReferenceException on line 19 of the code, a simply box u.u. Here is the code:
var iconoBoton : Texture2D;
function OnGUI(){
GUI.skin = this.gameObject.GetComponent(StartUpMenu).menuPrincipalSkin;
GUI.Box(new Rect(Screen.width/2 - 400, Screen.height/2 - 300, 800, 600), "");
GUI.Box(new Rect(Screen.width/2 - 400, Screen.height/2 - 300, 800, 600), "Menu Opciones");
if (GUI.Button(new Rect(Screen.width/2 + 215, Screen.height/2 + 250, 75, 30), "Aceptar")){
this.gameObject.GetComponent(StartUpMenu).clickOpciones = false;
this.gameObject.GetComponent(MenuOpciones).enabled = false;
}
if (GUI.Button(new Rect(Screen.width/2 + 300, Screen.height/2 + 250, 75, 30), "Cancelar")){
this.gameObject.GetComponent(StartUpMenu).clickOpciones = false;
this.gameObject.GetComponent(MenuOpciones).enabled = false;
}
GUI.Box(new Rect(Screen.width/2 - 350, Screen.height/2 - 250, 120, 45), "Graficos");
GUI.Box(new Rect(Screen.width/2 - 350, Screen.height/2 - 200, 100, 30), "");
if (GUI.Button(new Rect(Screen.width/2 - 350, Screen.height/2 - 200, 100, 30), "Calidad Media") || GUI.Button(new Rect(Screen.width/2 - 250, Screen.height/2 - 200, 30, 30), iconoBoton)){
GUI.Box(new Rect(Screen.widht/2 - 350, Screen.height/2 - 250, 100, 50), "Probando");
}
}
Can someone help me out?
Comment