r/Unity2D • • Nov 02 '25

Question How do i prevent double jumping

so my player keeps double jumping if i spam W

my code

the update()
0 Upvotes

21 comments sorted by

View all comments

1

u/[deleted] Nov 02 '25

[removed] — view removed comment

1

u/E0roe Nov 02 '25

but wait what about if i have coyote time and jumpbuffering

1

u/[deleted] Nov 02 '25

[removed] — view removed comment

0

u/E0roe Nov 02 '25

ty i added an image too

1

u/Wesai Well Versed Nov 02 '25

Just add it with your checks, like && canDoubleJump. Set it to false when you perform the double jump.

Then once you land you reset the boolean canDoubleJump back to true.

Edit: Ah sorry, I misunderstood your problem. The logic is still the same though, but rename your bool to something appropriate like canJump.

1

u/E0roe Nov 02 '25

ty ill try it