hi…there…i am trying to make a HUD for my game…where once a gui texture is clicked…it drops down 4 gui boxes…i want to make these boxes further click able…can someone check my code and tell me where i am going wrong…the gui boxes don’t give out any feedback except for a print
here’s the code
var normalTex : Texture2D;
var hoverTex : Texture2D;
var box : boolean = true;
var mouseInside = true;
var rect = (Rect(100,100,50,50));
function update ()
{
if (rect.Contains(Input.mousePosition))
mouseInside = false;
print ("inside");
}
function OnGUI ()
{
GUI.color = Color.blue;
if (box == false)
{
//GUI.Box(Rect(100,100,50,50), hoverTex);
GUI.Box(Rect(rect), hoverTex);
GUI.Box(Rect(100,150,50,50), hoverTex);
GUI.Box(Rect(100,200,50,50), hoverTex);
GUI.Box(Rect(100,250,50,50), hoverTex);
}
}
function OnMouseEnter ()
{
guiTexture.texture = hoverTex;
}
function OnMouseExit()
{
guiTexture.texture = normalTex;
}
function OnMouseDown()
{
guiTexture.texture = normalTex;
box = !box;
}
This is not helpful, there are lots of reasons to use gui boxes instead of gui buttons.
– Deeweext