Little disclaimer: I haven't posted on here before so please let me know if I'm missing any vital information
I'm making an order taking system for a game in Unity. This system has several size buttons that, when clicked should change the corresponding boolean value in my script to the opposite value. (if it was true it'll be false and vice versa). The boolean value that is changed depends on the button name and so far I can get the button name but I have issues when I try to convert it to a boolean.
Simply, my question is, how can I use the button names to change the right boolean values?
The 'bool size = bool.Parse(btnName);' line is attempting to create a temporary variable and use that variable to switch the values, but I'm not sure how to connect it to the boolean I've already created.
I've tried to convert the boolean in a different way (using Convert.ToBoolean and others). I've also tried passing in a parameter for the boolean but I can't find a way to pass in the right one depending on which button is pressed.
Also, I know I could have an if statement for every boolean and just compare the button name but I was trying to make it so my code isn't so repetitive if possible.