- Home /
Question by
saurabhn04 · Mar 17, 2014 at 02:00 PM ·
script errorgui-problem
GUI Box not appearing
I have unity 4.2.1 but when I enter function Update () {
}
function OnGUI()
{
GUI.Box(Rect(0,0,100,200));
}
it gives me an error: Assets/my scripts/inventory.js(8,8): BCE0023: No appropriate version of 'UnityEngine.GUI.Box' for the argument list '(UnityEngine.Rect)' was found.
is something wrong in my script or is there a problem in the installation?
Comment
Also, it looks like you have OnGUI inside the update function. This does NOT go in Update. It is a standalone function.
Answer by Professor Snake · Mar 17, 2014 at 02:02 PM
GUI.Box takes either two or three arguments. You need to at least specify the second argument that is the text that should be displayed over it. Try
GUI.Box(Rect(0,0,100,200),"");