I’m having a bit of trouble with this.
I am using if
Event.current.mousePosition to detect if the user clicks my gui elements.
When I place this in
OnGUI(), everything inside my if statement gets executed twice. I understand this is because
OnGUI() is executed twice per frame.
When I move the if statement to
Update(), I get null pointer errors, which I understand are because I need to use
Input.mousePosition when inside the
Input.mousePosition does not work, which I believe is because it is based on different coordinates or something?
How can I solve this?