hi guys i have a UI button thats connecting to a script on a prefab. I want the button to work when a bool is true. But the method the button is connecting to seems to just ignore the bool. This is the method the button is connecting to. the bool canDetShell is just ignored though. What can i do to get this working? Code (CSharp): private bool canDetShell = true; public void DetonateShell() { if (canDetShell) { print("Detonate shell"); } }
Hi, you just need to say what the bool should look like (true, false). write: Code (CSharp): private bool canDetShell = true; public void DetonateShell() { if (canDetShell = true) { print("Detonate shell"); } }
Hi, thanks for answering if (someBool) is the same as (someBool == true) its just a short way of declaring something true. but i worked out the problem the bool has to be public and then the check box in the inspector needs to be unchecked.