Question by
$$anonymous$$ · Oct 19, 2016 at 05:40 AM ·
buttonsetactive
return object state when SetActive return to true
i have a script that will SetActive buttonA on Input.GetMouseButtonDown(1)
. clicking on buttonA will SetActive buttonB. how do i return to original state, where buttonB is still hidden, when i re-activate buttonA ?
script in newGameObject to SetActive button A :
public GameObject buttonA;
void Start()
{
buttonA.SetActive(false);
}
void Update()
{
if (Input.GetMouseButtonDown(1))
{
buttonA.SetActive(!buttonA.activeSelf);
}
}
script in buttonA to SetActive buttonB :
public GameObject buttonB;
void Start()
{
buttonB.SetActive(false);
}
public void activateB()
{
buttonB.SetActive(!buttonB.activeSelf);
}
Comment
Your answer
Follow this Question
Related Questions
How to keep bool true even when other method try to set it off 0 Answers
setactive panel from other scene 0 Answers
SetActive not reacting on Buttonclick 0 Answers
C# - A way to set UI gameObject as active and then inactive when pressed a second time 0 Answers
Set GUI Text active/inactive by clicking on a button? 2 Answers