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 CharacterController.

3D FPSRPG
  • Camera-relative movement so the player moves where the camera faces
  • Sprint toggle with Left Shift and separate walk/sprint speeds
  • Smooth rotation via LerpAngle for natural turning
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 FPS or exploration game.

3D FPSHorror
  • Smooth mouse look with SmoothDamp for configurable input smoothing
  • Vertical angle clamping to prevent over-rotation
  • Automatic cursor lock on start with Escape toggle
2022.3+ · 2.4 KB
Health & Combat Intermediate

Weapon System

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

FPSRPG
  • ScriptableObject weapon definitions created via Assets menu
  • Supports both melee (range + angle cone) and ranged (projectile) attack types
  • Attack rate cooldown and ammo management with reload
2022.3+ · 3.8 KB
Health & Combat Beginner

Projectile System

Configurable projectile with speed, damage, lifetime, and optional homing. Integrates with Object Pool for zero-alloc shooting.

FPSGeneral
  • Configurable speed, damage, and lifetime per projectile
  • Optional homing behavior with adjustable strength and range
  • LayerMask-based hit filtering for selective collision
2022.3+ · 2.2 KB
Health & Combat Beginner

Health System

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

PlatformerFPS
  • Damage and healing with clamped health values
  • Invincibility frames with configurable duration after taking damage
  • UnityEvent callbacks for health changed, damaged, healed, and death
2022.3+ · 2.4 KB
Utilities Beginner

Camera Shake

Perlin noise camera shake with magnitude, frequency, and duration. Trigger from explosions, impacts, or any event.

FPSPlatformer
  • Perlin noise-based shake for smooth, organic camera movement
  • Configurable duration, magnitude, and frequency parameters
  • Automatic linear decay so shake fades out naturally
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 when player escapes.

RPGFPS
  • Detection radius with configurable field of view angle
  • Line-of-sight check using raycasts against obstacle layers
  • Chase behavior with smooth rotation towards the player
2022.3+ · 2.5 KB
Utilities Intermediate

Wave Spawner

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

FPSRTS
  • Configurable wave definitions with multiple enemy types per wave
  • Multiple spawn points with automatic round-robin distribution
  • Adjustable delay between spawns and between waves
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 to enemies or use as HUD.

RPGFPS
  • Smooth fill animation with Lerp for satisfying health changes
  • Color gradient that shifts from green to yellow to red automatically
  • Damage flash effect on the background image when health decreases
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