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
- PlayerController2D.cs Complete 2D character controller with smooth movement, variable-height jumping, and coyote time.
- CameraFollow2D.cs Smooth camera follow with offset, dead zone, and look-ahead for 2D games.
- PlatformerMechanics2D.cs Wall jump, wall slide, dash, and double jump mechanics for 2D platformers. Drop-in extension for the 2D Player Controller.
- HealthSystem.cs Reusable health component with damage, healing, invincibility frames, and events.
- Collectible.cs Collectible item with bobbing animation, rotation, magnet pull, and event callbacks for coins, health, ammo, etc.
- ScreenFader.cs Simple screen fade-in/fade-out with configurable color and duration. Great for scene transitions.
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
- Import all scripts into your Unity project
- Create a Player object with Rigidbody2D and BoxCollider2D
- Attach PlayerController2D and PlatformerMechanics2D
- Create GroundCheck and WallCheck child transforms
- Set up camera with CameraFollow2D targeting the player
- Add HealthSystem component to the player
- Create collectible prefabs with the Collectible script
- Add ScreenFader to a UI Canvas for level transitions
If something does not work
- The player never jumps
- PlayerController2D checks the ground with
Physics2D.OverlapCircleat 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, renamelinearVelocitytovelocityin 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.
Inspector
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
}Related
- FPS Foundation KitFirst-person shooter foundation with movement, camera, weapons, projectiles, health, and screen shake.
- RPG Essentials KitCore RPG systems: health, inventory, dialogue, quests, save/load, and damage numbers — everything for an RPG prototype.
- Build a 2D PlatformerEverything you need to create a complete 2D platformer from scratch — movement, camera, advanced mechanics, health, collectibles, and transitions.