Actor

The baseclass for most things

Actor

An Actor (AActor) is any object that can be placed in a level. You make the things in your world by inheritance from actor based classes and by adding ActorComponents to them.

BeginPlay() - When the actor has spawned and is completely initialized BeginPlay is called.

Tick() - Called every frame if the actor has tick enabled in it's constructor.

EndPlay() - Called when the actor is being removed from the world.

SetReplicates() - Select if actor should be replicated across network.


  • Spawn C++: GetWorld()->SpawnActor<>()

  • Access C++:

    • UGamePlayStatistics::GetAllActorsOfClass

    • MyComponent->GetOwner();

  • Access BP:


ActorComponent

Components are added to actors to handle particular tasks for the actor. Such as displaying a mesh with the StaticMeshComponent or handling movement with the CharacterMovementComponent. They are commonly created in the constructor of the actor. In bluepriunts use the Details window or the My Blueprint window to add or delete components. When the components exists it is possible to drag it into a eventgraph as a variable or right click it to add events related to it.

SceneComponent is a sub-class of component that have a transform (Position, Rotation, Scale) and supports attachment of other SceneComponents. The actors own transform is found in the RootComponent of the heirarcy of components.

InitializeComponent() -

TickComponent() -

UninitializeComponent() -

bIsActive - Enable or Disable the components, including calls to TickComponent.


  • Spawn C++: In a constructor use CreateDefaultSubobject<T>() to create a component. The name is displayed in the Blueprint component list.

  • Access C++:

    • MyActor->FindComponentByClass<UMyComponent>();

  • Access BP: