Trying to get a series of buttons to appear via a selection grid to appear when the user clicks on an object,I have it targeting itself and it can tell when it is clicked. But with or without the if statement, the selectiongrid will not appear.
void FixedUpdate ()
{
target = gameObject.transform;
point = Camera.main.WorldToScreenPoint(target.position);
// will make the menu appear if clicked on
if (Input.GetKeyDown (KeyCode.Mouse0))
{
if (Targeted)
{
toggle = true;
}
}
//this will make the menu vanish after the cursor leaves the object
if (Targeted == false)
{
toggle = false;
}
}
void OnGui ()
{
if (toggle)
{
Debug.Log ("that tickles");
selectionGridInt = GUI.SelectionGrid (new Rect(point.x, point.y, 100, 50), selectionGridInt, selectionStrings, 2);
}
}