Creating a player entity
In order to create an onscreen representation of the player, we'll need to derive from the Character
class in Unreal.
Inheriting from UE4 GameFramework classes
UE4 makes it easy to inherit from the base framework classes. All you have to do is perform the following steps:
- Open your project in the UE4 editor.
- Go to File and then select Add Code to Project....
- From here, choose the base class you want to derive from. You have Character, Pawn, Actor, and so on, but for now, we will derive from Character:
- Click on Next > to get this dialog box, where you name the class. I named my player's class
Avatar
. - Finally, click on Create Class to create the class in code, as shown in the preceding screenshot.
Let UE4 refresh your Visual Studio project when it asks you. Open the new Avatar.h
file from the Solution Explorer...