First-person standard character setup
To set up a first-person standard character, perform the following steps:
- Open the Package Manager Window (Window > Package Manager) and select the Character Controller package.
- Open the Samples tab, and then select Import to import the Standard Characters assets in your project. Unity adds the standard character files to your project, under the
Samples/Character Controller/[version]/Standard Characters
folder. - Create a subscene, if you haven't already.
- Navigate to the
Samples/Character Controller/[version]/Standard Characters/FirstPerson/Prefabs
folder. Drag the FirstPersonCharacter and FirstPersonPlayer prefabs into the subscene. - Select the FirstPersonPlayer GameObject.
- In the Inspector, navigate to the First Person Player Authoring component and under Controlled Character, set the FirstPersonCharacter GameObject:
- Open the FirstPersonCharacter GameObject's hierarchy and select the View GameObject.
- Navigate to the
Samples/Character Controller/[version]/Standard Characters/Common/Scripts/Camera
folder. Drag theMainEntityCameraAuthoring
script onto the View GameObject:
This component marks the View entity as the entity that your GameObject camera must follow. The View GameObject represents the camera point of the first person character. When you control the look input of the character, Unity rotates the View entity up and down. - Make sure your scene has a camera GameObject that isn't in a subscene. Drag the
MainGameObjectCameraAuthoring
script onto the camera. This component marks the camera as the GameObject that must copy the entity marked withMainEntityCameraAuthoring
every frame: