2D Platformer Starter Kit

Complete 2D platformer foundation with movement, camera, advanced mechanics, health, collectibles, and transitions.

6 scripts beginner Starter kit Best first system — perfect starting point

Download 2d-platformer-kit.zip 6 scripts and a README · 16 KB of C# · MIT

What is inside

What it does

  • Complete character controller with coyote time and jump buffering
  • Wall jump, wall slide, dash, and double jump mechanics
  • Smooth camera follow with look-ahead and dead zone
  • Health system with invincibility frames and events
  • Collectible items with bobbing animation and magnet pull
  • Screen fade transitions between levels

Setup, in order

  1. Import all scripts into your Unity project
  2. Create a Player object with Rigidbody2D and BoxCollider2D
  3. Attach PlayerController2D and PlatformerMechanics2D
  4. Create GroundCheck and WallCheck child transforms
  5. Set up camera with CameraFollow2D targeting the player
  6. Add HealthSystem component to the player
  7. Create collectible prefabs with the Collectible script
  8. Add ScreenFader to a UI Canvas for level transitions

If something does not work

The player never jumps
PlayerController2D checks the ground with Physics2D.OverlapCircle at the GroundCheck transform against Ground Layer. Put GroundCheck at the player's feet, put your platforms on a layer, and select that layer in Ground Layer; Nothing selected means the player is never grounded.
Wall jump and wall slide never trigger
PlatformerMechanics2D uses its own WallCheck transform and Wall Layer. Place WallCheck at the side the player faces and select the layer your walls use (it can be the same as the ground layer).
The scripts do not compile on Unity 2022.3
The controller and mechanics use Rigidbody2D.linearVelocity, which exists from Unity 6. On 2022.3, rename linearVelocity to velocity in both scripts, or use Unity 6.
The sprite jitters while the camera follows
Set the player's Rigidbody2D Interpolate option to Interpolate, and keep the camera following in LateUpdate, as CameraFollow2D does. Do not also move the player's Transform from your own code.
Every input call throws InvalidOperationException in a new Unity 6 project
The scripts read the legacy Input class, which new Unity 6 projects switch off. Set Project Settings > Player > Active Input Handling to Both and let the Editor restart. Details and the Input System alternative.

Preview

An excerpt of the kit's main types, and the Inspector fields they expose.

InspectorExcerpt

Fields from the kit's preview excerpt; the full kit has more.

Move Speed 8
Jump Force 16
Coyote Time 0.15
Enable Wall Jump
Enable Double Jump
Enable Dash
Excerpt
C#
// PlayerController2D.cs - Smooth 2D movement
[RequireComponent(typeof(Rigidbody2D))]
public class PlayerController2D : MonoBehaviour
{
    [SerializeField] private float moveSpeed = 8f;
    [SerializeField] private float jumpForce = 16f;
    [SerializeField] private float coyoteTime = 0.15f;
    // ... full controller with variable-height jump
}

// PlatformerMechanics2D.cs - Advanced movement
public class PlatformerMechanics2D : MonoBehaviour
{
    [SerializeField] private bool enableWallJump = true;
    [SerializeField] private bool enableDoubleJump = true;
    [SerializeField] private bool enableDash = true;
    // ... wall slide, wall jump, dash, double jump
}