Hi, I’m simply trying to make my player able to double jump. So far I’ve been able to make my player able to jump once until it’s grounded again; then I tried to add a jump counter. However Unity gives me an error message on jumpCount +1;
Does anyone know what I’ve done wrong and how to fix this?
Usually, when jumping, you would want to zero out vertical velocity before adding force to counter any gravity. Next, you have 2 scenarios you want to watch for. Grounded & jumping, Airborn & jumping & candoublejump. So you want something like
I think you mean less than, every time you jump the counter goes up, once it’s over 3 you can jump continuously. The error is also because you aren’t assigning that calculation to a variable, unlike Python you can’t just write ‘1+1’ and it will print the result. It will have to be ‘jumpCount = jumpCount + 1;’, or just += 1 or better yet jumpCount++.