Choosing a C++/BP Parent Class in Unreal Engine

What class to select to fit the needs? How they differ each other and for what purpose are they intended? Skip the intro to class list.>

C++/Blueprint Parent Classes in Unreal Engine

On creating a new class, either in C++ or Blueprint, there are many parent classes you can inherit from. There is a selection of Common Classes with a basic description and then a list of All Classes that are available for the project, see the screenshot below.

C++
Blueprint

Inheritance Class Hierarchy

Unreal Engine works with the Inheritance Hierarchy. That simply means, that there is a set of classes where each class extends it's parent class about custom functionality related to the purpose of the class. As the degault Unreal classes are usually defined with virtual / override functions architecture, any such function in any parent class can be customized and modified right from the inherited class. This is how a default Unreal Engine functions behavior can be extended for any custom logic.

Selecting the right Class for the requiired purpose

Selection of the right parent class depends on requirement functionality - each parent class offers a bunch of functions that you can later use in your inherited class. Knowing functions associated with parent classes is very important knowledge that prevent you from spending too much time in self-development of already existing ready-to-use features. That's why I summarize this basic overview of default Unreal Engine classes. The purpose of this page is to simply summarize main purpose and features of each class within the inheritance hiearchy. By clicking on selected class, you will be redirected to a page with examples related to the class.

Most used classes

None

  • Default constructor and destructor, nothing more

The list below is based on the Inheritance Hierarchy, which basically means that each inherited class just extends a functionality of its parent class for own extra features, see the list below.

  • UObject
    • UWorld

      UWorld is a base class representing a game world in Unreal Engine. Each project usually has one main instance of UWorld, in which all levels (ULevelStreaming) and activities of the game are located. UWorld contains information about the game environment, such as current players, current cameras, characters and objects in the game world.

    • AActor

      A at the start of class names below refers to the information that the classes are inherited from the Actor class.

      • APawn

        • Anything that can be possessed as a player, by a Controller
        • Handles movement input
        • ACharacter

          • It has Character movement component with a bunch of predefined movement modes (flying, swimming, crouching...) for bipedal characters. It offers also usefult functions such as e.g. IsFalling() for setting e.g. an custom airborne variable that is used for switching between State Machine animations.
          • As mentioned, ACharacter is usable especially for bipedal characters. In a case of other characters, it is usually better to inherit from APawn and define the movement logic on your own.
      • AInfo

        • AGameModeBase

          • Ideal for keeping rules, such as win condition
          • Sets default Pawn class
          • Starting / ending the application
          • Can be set as defualt GameMode at Project Settings → Maps & Modes → Default GameMode
          • AGameMode

            • Match state concept for Multiplayer Matches
      • AController

        • APlayerController

          Class for controlling the pawn properties, such as mouse pointer visual, camera shakes and so on. It's attached to AGameModeBase.

          It also manages player's View Point. View Point is handy when we there is need to reflect the property that the camera and e.g. a gun to aim to a different point. View point of the camera can be got from any actor (such as a gun) as follow OwnerController->GetPlayerViewPoint(VarToSaveLocation, VarToSaveRoration);

          Access GameMode functions from any class

          #include ExapleProjectGameModeBase.h
                  AExampleProjectGameModeBase* GameMode = GetWorld()->GetAuthGamemode<AExampleProjectGameModeBase>();
                  if(GameMode != nullptr){
                      GameMode->PawnKilledCustomFunction(this);
                  }
        • AAIController

          While the APlayerController relies on the human player to make decisions on what to do, the AIController is more focused on responding to input from the environment and game world. The job of the AIController is to observe the world around it and make decisions and react accordingly without explicit input from a human player.

    • UVisual
      • UWidget
        • UUserWidget

          A class responsible for Blueprint UI widget accessible through User InterfaceWidget Blueprint.

    • UDataTable
  • UBlueprintFunctionLibrary

    Base class for any function libraries exposed to blueprints. Methods in subclasses are expected to be static, and no methods should be added to this base class. It's also very handy for editor-based stuff and tools (works with files and so on).

    • UGameplayStatics

      A static class through which may be accessed any gameplay statics from any class.

ActorComponent

Creates an UActor derived component that can be placed as a component through Blueprint into any Blueprint Actor. It may keep variables and functionality for certain area, e.g. for the health in a case of custom Health component. The main benefir is that it can by reused with any classes.

Also, it can be binded (e.g. GetOwner()->OnTakeAnyDamage.AddDynamic(this, &UHealthComponent::DamageTaken)) to any Actor-inherited component in C++ for event handling.

Other interesting classes

FTimerManager

Class to globally manage timers - use it anytime there's a need to work with a time.

Animation Blueprints

Allows to set a logic for animations to combine and display animations from a list based on the input value.