Hello, I have hit a wall of frustration that I can’t seem to climb over and I am hoping that someone with more experience with Unity might have an answer for me. This is actually a very simple thing I am trying to do, but I just can’t seem to get it to work. So here goes…
I am trying to use a toggle as a simple check box to enable or disable a feature. The problem is that I can’t seem to get the toggle to flip the bool to true or false. Here is the very simple code that I am using.
void OnGUI(){
if (GUI.Toggle (queueRect, prodQueue, new GUIContent ("Queue"))) {
prodQueue = !prodQueue;
}
}
Now when I check prodQueue with a Debug.Log on click of the toggle, it shows two entries where it toggles it to true and then back to false on one click. This is driving me crazy as it is a very simple thing I am trying to accomplish and should only require the one line of code. Why is it toggling it twice from one click?