Hi guys,
So I made a custom script for a button to show and hide the options panel in my screen. But I found a small issue, the script works but it seems I have to click twice for it to work. Let me show you the script.
using UnityEngine;
using System.Collections;
public class ButtonOptions : MonoBehaviour
{
public GameObject optionsPannel = null;
private bool isActive = false;
void OnClick()
{
if (isActive == false)
{
NGUITools.SetActive (optionsPannel, true);
isActive = true;
}
else
{
NGUITools.SetActive (optionsPannel, false);
isActive = false;
}
}
}
Problem arises that I have to click twice for the buttons to work, any suggestion or help would be greatly appreciated.