intermediate

Build a First-Person Shooter

Movement, camera, weapons, projectiles, enemy AI, and screen effects for an FPS prototype.

9 scripts · 2 systems

Learning Path

Follow these steps in order to build your First-Person Shooter.

Included Scripts

Movement Intermediate

3D Player Controller

First/third person character controller with smooth movement, jumping, and slope handling using C...

3D FPSRPG
[RequireComponent(typeof(CharacterController))]
public class PlayerController3D : MonoBehaviour
{
    [SerializeField] private float walkSpeed = 6f;
    [SerializeField] private float sprintSpeed = 10f;
    [SerializeField] private float jumpHeight = 1.5f;
2022.3+ · 4.1 KB
Movement Beginner

First Person Camera

First person mouse look camera with sensitivity, vertical clamp, and cursor lock. Plug into any F...

3D FPSHorror
public class FirstPersonCamera : MonoBehaviour
{
    [SerializeField] private float mouseSensitivity = 2f;
    [SerializeField] private float minVerticalAngle = -90f;
    [SerializeField] private float maxVerticalAngle = 90f;
2022.3+ · 2.4 KB
Health & Combat Intermediate

Weapon System

ScriptableObject-driven weapon system with melee and ranged attacks, cooldowns, ammo, and damage ...

FPSRPG
public class WeaponSystem : MonoBehaviour
{
    [SerializeField] private WeaponData currentWeapon;
    public void Attack()
    public void EquipWeapon(WeaponData weapon)
2022.3+ · 3.8 KB
Health & Combat Beginner

Projectile System

Configurable projectile with speed, damage, lifetime, and optional homing. Integrates with Object...

FPSGeneral
public class Projectile : MonoBehaviour, IPoolable
{
    [SerializeField] private float speed = 20f;
    [SerializeField] private float damage = 10f;
    [SerializeField] private float lifetime = 5f;
    private void OnTriggerEnter(Collider other)
2022.3+ · 2.2 KB
Health & Combat Beginner

Health System

Reusable health component with damage, healing, invincibility frames, and events.

PlatformerFPS
public class HealthSystem : MonoBehaviour
{
    [SerializeField] private float maxHealth = 100f;
    public float HealthPercent => currentHealth / maxHealth;
    public void TakeDamage(float damage)
    public void Heal(float amount)
2022.3+ · 2.4 KB
Utilities Beginner

Camera Shake

Perlin noise camera shake with magnitude, frequency, and duration. Trigger from explosions, impac...

FPSPlatformer
public class CameraShake : MonoBehaviour
{
    public static CameraShake Instance { get; private set; }
    [SerializeField] private float defaultMagnitude = 0.15f;
    [SerializeField] private float frequency = 25f;
    public void Shake(float duration, float magnitude)
2022.3+ · 1.8 KB
AI & Pathfinding Beginner

Enemy Chase AI

Enemy AI that detects the player within radius, chases with line-of-sight, and returns to patrol ...

RPGFPS
public class EnemyChaseAI : MonoBehaviour
{
    [SerializeField] private float detectionRadius = 10f;
    [SerializeField] private float fieldOfView = 120f;
    [SerializeField] private float chaseSpeed = 5f;
2022.3+ · 2.5 KB
Utilities Intermediate

Wave Spawner

Wave-based enemy spawner with configurable wave definitions, spawn points, delays, and wave compl...

FPSRTS
public class WaveSpawner : MonoBehaviour
{
    [System.Serializable]
    public class Wave
    {
        public string waveName = "Wave";
        public EnemySpawn[] enemies;
    }
    private IEnumerator SpawnWave()
2022.3+ · 3.0 KB
UI Beginner

Health Bar UI

World-space or screen-space health bar with smooth fill, color gradient, and damage flash. Attach...

RPGFPS
public class HealthBarUI : MonoBehaviour
{
    [SerializeField] private float smoothSpeed = 5f;
    [SerializeField] private Gradient colorGradient;
    public void SetHealth(float current, float max)
2022.3+ · 2.4 KB

Related Systems

FPS Foundation Kit

intermediate 6 files

First-person shooter foundation with movement, camera, weapons, projectiles, health, and screen shake.

FPSHorror
3D character controller with sprint, jump, and slope handling First person mouse look with sensitivity and vertical clamp ScriptableObject weapon system (melee and ranged) Pooled projectiles with damage, homing, and impact VFX

Enemy AI Kit

intermediate 6 files

Complete enemy AI pipeline: state machine, patrol, chase, health, and wave spawning with debug visualization.

RPGFPSGeneral
Finite state machine with clean enter/execute/exit lifecycle Waypoint patrol with loop, ping-pong, and random patterns Player detection with radius, FOV, and line-of-sight checks Chase behavior with give-up distance and return-to-origin