Hi there.
Im having a hard time creating a simple gui toggle.
I want the GUI to toggle between on/off when the player clicks anywhere on the screen, UNLESS the click is on the GUI.
Im using tooltips to know whenever the mouse is over a gui-element, but the problem seems to be that during the actual click, the tooltip is null. Even when the mouse is still over the gui.
This is what i have so far:
private string currentTooltip = "";
void Update ()
{
if (string.IsNullOrEmpty(currentTooltip))
{
if (Input.GetMouseButtonDown(0))
{
DisplayBunkerGUI = DisplayBunkerGUI ? false : true;
}
}
}
void OnGUI()
{
if (DisplayBunkerGUI)
{
GUI.Button(new Rect(50, 50, 100, 100), ToolTipEnter);
}
currentTooltip = GUI.tooltip;
}
So when i click outside the button, the GUI toggles fine, but when I click on the button, the GUI still toggles.
Anyone got any suggestions?