FPS (Unity 2021.3 LTS)
FPS (Unity 2021.3 LTS)
Setup
Creating the project
Importing the Starter Assets
Changing the Input System
Click on “Add to My Assets”. You might need to login into your Unity account. After that,
click on “Open in Unity”. The asset will not appear in the Package Manager, ready to be
imported.
During the years, Unity has created and maintained a lot of different packages to support the
creation of games. Both First Person and Third Person controllers were originally shipped
inside Unity and called “Standard Assets”. They were then moved to the Asset Store (where
they still live) but have been discontinued since Unity 2019. A new version has been
re-uploaded by Unity under the name “Starter Assets” and is the right way to go from Unity
2020 onwards.
Changing the Input System
The First Person Controller from the Starter Assets pack uses Unity’s new Input System.
Unity has changed the way you can read inputs (keyboards, joypads, touch screens…) at
least three times. All of these are sort-of incompatible with each other.
The new Input System, however, does not offer feature-parity with its predecessors and is
much more complex to setup. For this reason, I suggest changing the project settings to
enable both the old and new systems to work.
Go to Edit > Project Settings and select the Player tab. This refers to the Unity player (the
code that runs the game), not the player character.
Change the Active Input Handling* to Both. This might require a restart.
Import the FPS Controller
Once your level is created, you can import the FPS controller into your scene.
From the Project window, visit the folder
Assets/StarterAssets/FirstPersonController/Prefabs, and drag these three prefabs into
the Hierarchy window:
● MainCamera (and delete the default MainCamera)
● PlayerFollowCamera
● PlayerCapsule
The FPS controller uses its own camera, so you will need to delete the “Main Camera” game
that was already in your scene.
Then, you need to connect those prefabs togethers. Drag the PlayerCameraRoot game
object (child of PlayerCapsule) into the Follow slot of the PlayerFollowCamera game
object.
The FPS controller is using Cinemachine to control the movement of the main camera. That
is another popular package that Unity has created, which is often used for camera transitions
and cinematic sequences.