Global Variable changing incorrectly?

I have a global variable called PointsTotal which is supposed to increase by 100 when I press a button, but instead it increases by a different amount sometimes 200, 300 or 500 each time I open the scene and press a button. I don’t know what is happening.

Add Trigger Once in the event so you ensure that on touch only runs one time

Ulises is correct above.

For more detail, the important thing to know is that every event is processed from top of the event list to bottom every frame. Your mouse button will be down for more than one frame, therefore that event will trigger more than once.

1 Like