How to keep bool true even when other method try to set it off
Hi, i'm fairly new with coding and right now i'm making a game mode selector.
The problem is that I have two methods with fairly similar cases and this is what should happen:
when I click a button, it should activate the Firstmethod that contains bools for gameobjects. And when I click another button, it should activate the SecondMethod with similar aspects. When I click either button again, it only deactivates gameobjects that are not in the other method.
now the problem is that when the SecondMethod is deactivated, it also deactivates the FirstMethods gameObjects that are in the SecondMethod
Ex.
public void FirstMethod(bool isOn) { gameObject1.setActive(isOn) gameObject2.SetActive(isOn) }
public void SecondMethod(bool isOn) { gameObject1.SetActive(isOn) gameObject3.SetActive(isOn) }
If done like this, the gameObject1 in the FirstMethod will be deactivated aswell. Is there any good way to check if the FirstMethod has the same gameobject active and when the SecondMethod is being deactivated it wouldn't set the gameObject1 off?
Your answer
Follow this Question
Related Questions
Reference a script on a gameobject that is disabled in scene 0 Answers
Toggle a bool on only one object at a time by tapping an object. 0 Answers
SetActive is just working if i press twice in the first time 2 Answers
gameObject.SetActive (false); Not working 0 Answers
Activate when mouse klick object 1 Answer