Home and Learn: Games Programming Course
Added May 2025, Unity 6, using URP
In this section, you'll learn the mechanics of first person shooter games. We'll have a character that can walk around and shoot things, and we'll have an enemy zombie that can attack us and cause damage. We'll tackle animations, health scripts, gun sights, skyboxes, prefabs, and a whole lot more. The short video below shows you what you will be creating in this section:
In the next lesson, you'll learn how to build that scene in the video above using free game assets. But this is a big section, so let's get started. We're going to have something called a first person controller. This will be our player. We'll download a ready-made one from the Unity Asset store.
So, start up your Unity Hub, if you haven't already. From the Unity Hub, click the New Project button. In the templates area, select the Universal 3D template. This uses the Universal Render Pipeline. (The other options are the Built-In Render Pipeline, and the High Definition Render Pipeline.)
Give your project a name in the Project Name box. We called ours First Person Shooter. Then click Create Project:
We need to download a First Person Character Controller. This will have all the movement scripts already attached to it, so we won't have to write any code for our character to do things like run, walk, jump, etc.
Unity themselves have a First Person Character Controller we can use. From the menus at the top of Unity 6, click Window > Asset Store. Once the Asset Store loads in your browser, go to this page:
If the link no longer works, type the following into the Asset Store search box:
Starter Assets - FirstPerson
Click the button on the Assets Store page to download and add the controller to your project. The Unity Package Manager should open for you:
Click the Download button. (If you have already downloaded the asset, it will say Import, as in the image above).
Once you install, you'll see this box:
Import the assets and your Unity Project area should look like:
Move into the following folder:
Assets > StarterAssets > Environment > Art > Models
Drag and drop the Ground_Mesh object into your scene:
With the Ground_Mesh selected in your Hierarchy (you can rename it to Ground) have a look at the Inspector on the right. Click the three tiny dots in the top right and select Reset from the menu that appears (It will reset the position to all zeros):
Your player would fall through this mesh, however, because it doesn't have a collider attached. So, with the Ground selected in the Hierarchy on the left, have a look at the Inspector on the right. Click the Add Component button. Type mesh in the search box. Double click the Mesh Collider item:
Now let's add our player to the scene.
Move inside of the following folder:
Assets > StarterAssets > FirstPersonController > Prefabs
Locate the prefab called PlayerCapsule:
Drag and drop it onto your Ground object in the scene. In the Hierarchy on the left of Unity, right-click your capsule and rename it to Player:
Once you have dragged the first person controller into your scene, it should be ready to go!
Start your game and you should find that you can walk around. Press the WSAD keys to walk around (or the arrow keys). Press the spacebar to jump. Hold down the left SHIFT key to run.
One thing you will notice is that the camera is static - it doesn't move with the player. Let's fix that.
In the Project area at the bottom of Unity, open the following folder again:
Assets > StarterAssets > FirstPersonController > Prefabs
Notice that there are two blue cubes. These are camera prefab objects, one called MainCamera, and one called PlayerFollowCamera:
We'll need both of these. So drag the PlayerFollowCamera to the Hierarchy first:
With the PlayerFollowCamera selected in the Hierarchy, have a look at the Inspector on the right. Notice there is an empty slow to the right of Follow:
Click the circle to the right of None (Transform) where the red arrow is pointing in the image above. You'll see this dialog box:
Double click the Transform called PlayerCameraRoot. It will then get added to the Follow area:
To see where this PlayerCameraRoot is coming from, have a look at the Hierarchy on the left. Expand the Player object and you'll see it there:
We now need to add the Main Camera prefab, even though we have a Main Camera in our scene (we'll delete this).
So go back to this folder in the Projects Area of Unity:
Assets > StarterAssets > FirstPersonController > Prefabs
Drag and drop MainCamera into the Hierarchy:
The Hierarchy should look like this:
With the MainCamera object selected, the Inspector will look like this:
Notice the area highlighted with a red box in the image above. What's happening is that MainCamera is the brain, and it has set the second camera, the PlayerFollowCamera, to be it eyes, known as the Live Camera. So we don't need the other Main Camera, the one at the top. Select this camera in the Hierarchy. Then press the delete key on your keyboard to get rid of it. The Hierarchy should then look like this:
Try your game out again. You should now be able to walk around and the camera will follow.
One last thing you can do is to increase the size of the Player. Click on the Player in the Hierarchy. In the Inspector on the left, change the Scale values for X, Y and Z in the Transorm area at the top. Change them all to 1.8.
In the next lesson below, you'll build a better scene as we download some more free game assets.
How to build a scene with free game assets -->
<--Back to the Unity 3D Course Contents Page
Email us: enquiry at homeandlearn.co.uk