Getting Started

A Pawn is a character in a scene which can interact with its surroundings.Usually the Pawn is controlled by player input.

The best way to start is to create a GameObject with a Unity Character Controller first and add a Pawn Control component to it:

Note that the origin of a character controller is in the centre, so if you want the pawn to be positioned on the ground, you need to add half the CharacterController Height (= 2 in this example) to the Transform Position Y value (which is set to 1 here for this reason).

Controller Input

If you want to control the pawn with an input device, you can add the Controller Input component to the Pawn.

For this example we want to use the Xbox Game Controller. So we set the Game Controller value of the Pawn Control component to ‘Xbox’.

We want the left stick control the movements of the Pawn. For that, we set the Left Stick Vertical to the following values:

  • Event Type = Continuous. The input should be updated continuously
  • Parameter Type = float, We want to control the speed with a value between -1 and 1.
  • Event (Single)->Object = Pawn (PawnControl): we want to control this pawn
  • Event (Single)->Function = PawnControl->(dynamic float)MoveForward: the vertical axis should control de forward movement of the Pawn. Note that you should choose the dynamic float MoveForward version at the top of the list and not the static value MoveForward (float) version. Otherwise the pawn will get a constant forward speed which does not let you control the movement.

Then for the horizontal axis we do the same, but instead of MoveForward we use MoveSideward:

Now you can control the pawn with the Xbox controller, moving around. The Character Controller will take care of any collisions.

First Person Pawn

If you want to change the Pawn to a first person character, you should enable the Camera Target.

Expand the Targets section in the Pawn Control component and click on the Show button of the Camera Target:

This will add a first person Camera to the pawn:

Virtual Reality

To use virtual Reality, first make sure it is enabled in the Edit Menu->ProjectSettings->Player->XR Settings and that the right SDK is added to the Virtual Reality SDKs.

If you go back to the Pawn Control component and expand the Targets section, you will see that two additional targets have become available: the Left and Right Controller Target. Enable these if you want to use hand controllers:

You will now see that the pawn has a camera and two hand controllers:

When pressing player you will be able to walk around with the headset and move the controllers. You can also use the left controller stick or touchpad to walk around just like we did with the Xbox controller.