game engine:unity3d
scripting language: unityscript
code:
var setmenu:GameObject;
var settings_menu:boolean;
function Start() {
settings_menu=false;
}
function settingButtonClick(){
if(settings_menu==false)
{
setmenu.SetActive(true);
settings_menu=true;
}
else
{
setmenu.SetActive(false);
settings_menu=false;
}
}
The problem is I have to click the UI button twice to SetActive to become false for the 1st time. But after that when I again activate and then press to deactivate it works fine with single click.