First of all, don't tell me this is a really bad idea and a draw-call-boosting solution. I already know. :)
I'm creating a GUI using a second camera rendering GUI objects (planes with textures to represent buttons) to avoid issues with Unity's built in GUI system, but I've run across a problem. How would I create a toggle button?
I tried something like this (complete and utter psuedocode):
clicked = false;
OnMouseOver && OnMouseDown() {
if(clicked) clicked = false;
if(!clicked) clicked = true;
}
However, when I click this, the variable remains false. I assume this is because your click is recorded several times per frame, so it would be set to true, then to false again. If that's the case, is there another method to create a toggle button outside the standard GUI system?
Thanks, Elliot Bonneville.
Yes, but then I need to be able to change it back.
– e-bonnevilleIt does change the value every (OnMouseOver && OnMouseDown()) from false to true to false ... efge 0 secs ago
– efgeIf false it sets it to !false which is true. if true it sets to !true which is false. It works perfectly.
– anon73820239Oh, I see. I apologize, you're right. :) Accepting and upvoting.
– e-bonneville