Unity 2D Platformer Scripts: Player, Camera, Health, Collectibles

Build a small Unity 2D platformer slice with free scripts for movement, camera follow, health, collectibles, transitions, and setup mistakes to avoid.

Build path: For a fast 2D platformer prototype, combine 2D Player Controller, Smooth Camera Follow 2D, 2D Platformer Mechanics, Health System, Pickup / Collectible, and Screen Fader. The packaged option is the 2D Platformer Starter Kit.

A platformer does not need a giant framework to feel playable. It needs responsive movement, a camera that follows without jitter, a damage loop, a pickup loop, and a clean transition between levels. Add those in order and you have a slice that can be tested in minutes.

The Minimum Script Stack

2D Platformer Stack

NeedScriptNote
Run and jumpPlayerController2D2D Player Controller handles Rigidbody2D movement, jumping, coyote time, and jump buffering.
Camera followCameraFollow2DSmooth Camera Follow 2D keeps the player framed with offset and smoothing.
Advanced movesPlatformerMechanics2D2D Platformer Mechanics adds wall jump, wall slide, dash, and double jump.
Damage stateHealthSystemHealth System gives the player and enemies a shared damage API.
CollectiblesCollectiblePickup / Collectible handles coins, health pickups, keys, and score objects.
Scene transitionsScreenFaderScreen Fader hides scene-load cuts and makes restarts feel intentional.

Setup Order

  1. Create a Player GameObject with Rigidbody2D and BoxCollider2D.
  2. Attach 2D Player Controller and assign ground-check references.
  3. Add 2D Platformer Mechanics only after basic movement is stable.
  4. Attach Smooth Camera Follow 2D to the Main Camera and assign the player target.
  5. Add Health System to the player and enemies.
  6. Create collectible prefabs with Pickup / Collectible.
  7. Put Screen Fader on a UI Canvas for scene transitions.

Common Mistakes

  • Ground check too high: Put the ground-check transform at the feet, not the sprite center.
  • Camera jitter: Let the camera follow in LateUpdate and avoid moving the player Transform manually while also using Rigidbody2D physics.
  • Too many mechanics at once: Tune run and jump first, then add dash, wall jump, or double jump one at a time.
  • Collectibles without feedback: A pickup should change score, play a sound, or trigger UI. Otherwise the loop feels unfinished.

When to Use the Kit Instead

Use the 2D Platformer Starter Kit if you want all of these scripts already grouped as a foundation. Use individual scripts if your project already has movement or camera code and you only need one missing piece.

For the full catalog of scripts across genres, start with Free Unity C# Scripts and Game Systems.

Reviewed resource

Built by Scripts For Unity

Scripts For Unity is maintained as a practical Unity scripting library by Framed Arc. The focus is copyable C# code, Inspector-friendly setup, and complete small systems that solo developers can adapt without importing a large framework.

Sources