FPS Foundation Kit

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

6 scripts intermediate Starter kit Great for FPS prototyping

Download fps-foundation-kit.zip 6 scripts and a README · 17 KB of C# · MIT

What is inside

What it does

  • 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
  • Health system with invincibility and event callbacks
  • Perlin noise camera shake for impacts and weapon fire

Setup, in order

  1. Import all scripts into your project
  2. Create Player with CharacterController component
  3. Attach PlayerController3D to the player
  4. Add Camera as child, attach FirstPersonCamera
  5. Create WeaponData ScriptableObjects for your weapons
  6. Attach WeaponSystem to player, assign attack point
  7. Create projectile prefab with Projectile and trigger collider
  8. Add CameraShake to camera, trigger from weapons

If something does not work

The mouse does not turn the view
FirstPersonCamera locks the cursor on start and pauses look while the cursor is unlocked; Escape unlocks it. Click inside the Game view to lock it again. Also check that the camera is a child of the player and that the player body is assigned.
The player cannot jump or falls slowly
PlayerController3D checks the ground with Physics.CheckSphere at its ground check point against Ground Mask. Put the point at the feet and select your floor's layer in Ground Mask.
Projectiles pass through targets
Projectile reacts in OnTriggerEnter, so its collider must be a trigger and either it or the target needs a Rigidbody. Check that the Hit Layers mask includes the target's layer.
The Weapon Data menu is missing
Weapon assets are created from Assets > Create > Weapons > Weapon Data. If the menu is missing, a compile error is stopping the scripts from loading; fix the Console errors first.
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.

Weapon Name
Is Melee
Damage 10
Attack Rate 1
Projectile Prefab None (GameObject)
Current Weapon None (WeaponData)
Excerpt
C#
// WeaponData.cs - ScriptableObject weapon definition
[CreateAssetMenu(menuName = "Weapons/Weapon Data")]
public class WeaponData : ScriptableObject
{
    public string weaponName;
    public bool isMelee;
    public float damage = 10f;
    public float attackRate = 1f;
    public GameObject projectilePrefab;
}

// WeaponSystem.cs - Attack controller
public class WeaponSystem : MonoBehaviour
{
    [SerializeField] private WeaponData currentWeapon;
    public void Attack() { /* melee or ranged */ }
    public void EquipWeapon(WeaponData weapon) { /* swap */ }
}