Sticks++ adds +1 each time , which is what I want but sticks-- doesn't -1 each time , why does this happen?For example if int = 50 it subtracts 6 and keep on going . I need it to -1 from the int value each time.
I've used -= 1 already , I get the same result . When Int = 50 and Q is pressed once , it subtracts 26 for some reason . I'm aware it won't stop at 0 but I still don't understand why it doesnt subtract 1 each time.
try: Code (csharp): void AddSticks() { Debug.Log("before adding, sticks was: " + sticks); sticks++; Debug.Log("after adding, sticks was: " + sticks); } void RemoveSticks() { Debug.Log("before removing, sticks was: " + sticks); sticks--; Debug.Log("after removing, sticks was: " + sticks); } Also, please post your code in Code Tags rather than a screenshot, so we can copy-paste it when helping.
Is it a fixed number that gets removed? or random? Maybe u are using onbutton/key instead of onbutton/key down?