05 — 2D Platformer Movement

Run Tools → Input System Starter Kit → Create 2D Platformer Demo in an empty scene, press Play, and feel it: run with A/D or the stick, jump with Space — tap for a hop, hold for full height. Then open Scripts/Platformer2D/PlayerController2D.cs and follow along.

The input layer (the part this course is about)

That pairing — poll the values, subscribe to the moments — is the pattern you'll reuse in every genre.

The physics layer (quick notes for completeness)

The game feel layer (why it doesn't feel like a school project)

Comment each of these out (they're clearly marked) and play again — students immediately understand why every good platformer does this.

Exercises

  1. Wire the Dash you added in 03 - The Input Actions Asset: find the action in OnEnable, subscribe performed, and impulse body.linearVelocity in the facing direction. Bonus: a cooldown timer.
  2. Change Move's gamepad binding to add a Processor (select the leftStick binding → Properties → Processors → Stick Deadzone) and raise the deadzone until drift stops on an old controller — no code, that's the point.
  3. Add a Crouch action bound to S/left-stick-down that halves the collider height.

Compare with the community approaches in this video platformer series and this written one.

Next: 06 - First-Person and Weapon Switching