当前位置:网站首页>Can I "reverse" a Boolean value- Can I 'invert' a bool?

Can I "reverse" a Boolean value- Can I 'invert' a bool?

2022-07-04 15:52:00 Bustling city

problem :

I have some checks to see if a screen is active. I have some checks to see if the screen is active .The code looks like this: The code is as follows :

if (GUI.Button(new Rect(Screen.width / 2 - 10, 50, 50, 30), "Rules")) //Creates a button    {        if (ruleScreenActive == true) //check if the screen is already active            ruleScreenActive = false; //handle according to that        else             ruleScreenActive = true;    }

Is there any way to - whenever I click the button - invert the value of ruleScreenActive ? What can be done - Whenever I click a button - reverse ruleScreenActive Value ?

(This is C# in Unity3D)( This is a Unity3D Medium C#)


Solution :

Reference resources : https://stackoom.com/en/question/bOVd
原网站

版权声明
本文为[Bustling city ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202141218254073.html