Free Unity C# Scripts and Game Systems: 55 Copy-Paste Tools for Indie Games
A catalog of 55 free Unity C# scripts and 13 game systems: movement, camera, health, save/load, UI, AI, mobile controls, inventory and dialogue.
This page is a practical index, not a theory article. If you are building an indie game and need working Unity C# code today, use it to pick the right script by problem: movement, camera, health, save/load, UI, AI, mobile input, inventory, dialogue, audio, and utility infrastructure.
The strongest use case is prototyping. You can copy one script into an existing project, or combine a small set of scripts into a playable slice. Each script page includes source code, Inspector notes, usage steps, and common mistakes, so you can adapt the code instead of treating it as a black box.
Choose by Game Problem
Unity Script Picker
| Problem | Start Here | Note |
|---|---|---|
| 2D movement | 2D Player Controller | Use PlayerController2D with CameraFollow2D for platformers. |
| 3D or FPS movement | 3D Player Controller | Pair PlayerController3D with FirstPersonCamera. |
| Health and damage | Health System | Use HealthSystem, then add HealthBarUI and DamagePopup. |
| Saving progress | JSON Save Utility | Use JsonSaveUtility for structured save data and PlayerPrefs Save Helper for simple settings. |
| Inventory and quests | RPG Essentials | Start with RPG Essentials Kit or combine SimpleInventory, QuestSystem, and DialogueTrigger. |
| Mobile controls | Mobile Controls Kit | Use TouchJoystick, TouchButton, SwipeInputController, and MobileSafeArea. |
| AI movement | Enemy AI Kit | Use WaypointPatrolAI, EnemyChaseAI, NavMeshClickToMove, and AStarPathfinding. |
| Project utilities | Essential Utilities | Every prototype benefits from ObjectPool, AudioManager, SceneManager, and TimerCountdown. |
Start a Game in 30 Minutes
The fastest path is to pick a small game target and wire only the scripts needed for that slice. Do not begin by importing every script. Start with the smallest set that proves movement, feedback, saving, and one loop.
- 2D platformer: Use 2D Platformer Starter Kit, or combine 2D Player Controller, Smooth Camera Follow 2D, Health System, Pickup / Collectible, and Screen Fader.
- FPS prototype: Use FPS Foundation Kit, or combine 3D Player Controller, First Person Camera, Weapon System, Projectile System, and Camera Shake.
- RPG slice: Use RPG Essentials Kit, or combine Health System, Simple Inventory, Dialogue Trigger, Quest System, and JSON Save Utility.
- Mobile game: Use Mobile Controls Kit, or combine Touch Joystick, Touch Button, Swipe Input Controller, and Mobile Safe Area Handler.
- RTS prototype: Use RTS Starter Kit, or combine Top-Down Camera, NavMesh Click-to-Move, Minimap System, and Wave Spawner.
- Idle game: Use Idle Game System with Idle Income Generator, Timer / Countdown, and PlayerPrefs Save Helper.
Essential Scripts Every Unity Project Needs
Some scripts are useful regardless of genre. These are the pieces that reduce repeated glue code and make prototypes less fragile.
- Object Pool - reuse bullets, enemies, damage numbers, and effects instead of instantiating every time.
- Audio Manager - centralise one-shot sounds, music crossfades and volume.
- Scene Manager - wrap scene transitions so buttons and triggers call one stable API.
- Health System - give players, enemies, breakables, and bosses a consistent damage contract.
- JSON Save Utility - save structured game state without building a save framework from scratch.
The utility layer
Utility scripts decide how painful a project becomes after the first prototype. If bullets, sounds, scene loads, timers and saving are solved differently in every feature, the game gets harder to change. Add this layer early and your feature scripts stay small.
Utility script picker
| Problem | Use | Note |
|---|---|---|
| Repeated spawning | Object Pool | Object Pool for bullets, effects, enemies, pickups and floating text. |
| Sound playback | Audio Manager | Audio Manager centralises music, one-shots, fades and volume. |
| Level changes | Scene Manager | Scene Manager wraps loading so buttons and triggers share one API. |
| Countdowns and cooldowns | Timer / Countdown | Timer / Countdown for timed rounds, cooldowns and UI timers. |
| Shared managers | Generic Singleton | Generic Singleton for a few global services, used sparingly. |
| Structured save data | JSON Save Utility | JSON Save Utility stores typed state in readable files. |
| Transitions | Screen Fader | Screen Fader hides hard scene cuts. |
| Hit feedback | Camera Shake | Camera Shake makes impacts readable. |
When to skip a utility
Do not add a manager because one exists. A singleton suits one global audio service, not per-enemy state. A pool suits objects spawned again and again, not a single persistent object. PlayerPrefs is enough for one volume setting; a JSON save suits structured game state.
- Pooling without reset: pooled objects must reset health, velocity, animation state and event subscriptions before reuse.
- Global everything: too many singletons make scenes hard to test and set up.
- Audio spam: limit how often a frequent sound can play so one event does not stack dozens of clips.
- Scene names as magic strings: keep scene names in one place if many buttons load scenes.
When Not to Copy a Script Blindly
Copy-paste scripts save time, but they are not magic. Treat every script as a starting point that needs a quick fit check against your project. The goal is speed with control, not mystery code.
- Unity version: Most of these scripts target Unity 2022.3 LTS and newer; a few use Unity 6 physics APIs and need Unity 6. Each script page states its version.
- Input system assumptions: Some scripts use the built-in Input API. If your project uses the newer Input System package, adapt the input wrapper rather than editing gameplay logic everywhere.
- Inspector setup: Many scripts use
[SerializeField]. Missing references are the most common setup bug, so read the usage steps before pressing Play. - Serialization limits: PlayerPrefs is fine for small preferences. Use JSON or a proper save system for game state, inventory, quest progress, or multiple save slots.
- Dependencies: Individual scripts are designed to stand alone where possible. Complete game systems intentionally include multiple scripts that expect each other.
How to Use These Scripts Safely
- Create a new C# file with the exact class name shown on the script page.
- Paste the source code and let Unity compile before adding it to objects.
- Attach the component to the recommended GameObject type, such as Player, Camera, Manager, or UI Canvas.
- Assign every required Inspector field and read the common mistakes section.
- Test the script in an empty scene before mixing it into a large project.
- Rename variables and tune values only after the baseline behavior works.
Scripts and kits in this article
- 2D Player ControllerComplete 2D character controller with smooth movement, variable-height jumping, and coyote time.
- Smooth Camera Follow 2DSmooth camera follow with offset, dead zone, and look-ahead for 2D games.
- Health SystemReusable health component with damage, healing, invincibility frames, and events.
- Object PoolGeneric object pooling system to reduce garbage collection. Perfect for bullets, particles, and enemies.
- Audio ManagerComplete audio manager with music crossfade, SFX pooling, volume control, and persistence.
- Scene ManagerAsync scene loading with loading screen, progress bar, and minimum load time. Clean transitions between levels.
- JSON Save UtilityFile-based JSON save/load utility. Save any serializable class to persistent storage with one method call.
- Simple InventoryLightweight list-based inventory for prototypes. Add, remove, and check items without UI complexity.
- Quest SystemLightweight quest tracker with ScriptableObject definitions, objectives, progress tracking, and reward callbacks.
- Touch JoystickVirtual on-screen joystick for mobile touch input with dynamic or fixed positioning. Outputs normalized Vector2 direction suitable for character movement.
- NavMesh Click-to-MoveClick-to-move character controller using NavMeshAgent. Click anywhere to navigate, with destination marker and path line.
- Minimap SystemRender texture minimap with player icon, enemy blips, objective markers, and zoom control.
- Timer / CountdownVersatile timer with countdown, stopwatch, and repeating modes. Formatted time display and UnityEvent callbacks.
- Generic SingletonThread-safe, persistent singleton base class for managers like AudioManager, GameManager, etc.
- Screen FaderSimple screen fade-in/fade-out with configurable color and duration. Great for scene transitions.
- Camera ShakePerlin noise camera shake with magnitude, frequency, and duration. Trigger from explosions, impacts, or any event.
- 2D Platformer Starter KitComplete 2D platformer foundation with movement, camera, advanced mechanics, health, collectibles, and transitions.
- 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.
- Mobile Controls KitComplete touch input system for any mobile Unity game — virtual joystick, on-screen buttons, swipe gestures, pinch-to-zoom, gyroscope, and safe area handling.
- RTS Starter KitReal-time strategy foundation with camera, click-to-move navigation, unit selection, minimap, and wave spawning.
- Idle Game SystemCore systems for idle/incremental games — passive income generation, offline earnings, upgrade progression, number formatting, and responsive mobile UI.
Related articles
- Unity 2D Platformer Tutorial: Free Scripts & Complete SetupBuild a complete 2D platformer in Unity with free scripts for player movement, camera follow, collectibles, health, and polish effects. Step-by-step guide with code.
- How to Build an RPG Quest System in UnityBuild a complete RPG quest system in Unity with ScriptableObject-driven objectives, branching conditions, and persistent progress tracking.
- How to Add Touch Controls to Your Unity Mobile GameComplete guide to implementing mobile touch controls in Unity. Covers virtual joystick, on-screen buttons, swipe gestures, pinch to zoom, and safe area scaling.
- 10 C# Patterns Every Unity Developer Should KnowFrom Singleton to Observer, master the design patterns that will level up your Unity projects.
Sources
Written by Mete, the Unity developer who makes Scripts For Unity and shares it free with the community. Articles cite the Unity documentation they rely on, state the Unity version they were written for, and show an updated date only when the text or code changed. How articles are written and checked