Actor

Introduction Actor is one of the most important aspects of Unreal Engine, it lays at the core of everything you will do interacting in the Unreal Editor viewport and the Game World. This core Unrea...

Updated over 3 years ago Edit Page Revisions

Introduction

Actor is one of the most important aspects of Unreal Engine, it lays at the core of everything you will do interacting in the Unreal Editor viewport and the Game World. This core Unreal Engine Class AActor forms the basis for any Object you can see in the viewport in the 3d space, this does not include UMG widgets which are overlays.

Components

Actors are made up of various Components.

C++

Spawn

Spawning refers to the process of creating an Actor, similar to New Object though having a physical presence in the game world means Actors are treated differently, because they have components like collision. If an Actors Spawn location is being blocked we call that Enroachment, its when two Actors (or more) share the same physical space.

GetWorld()->SpawnActor();

Since there is a requirement to having a game world we must first GetWorld to call Spawn on, this function is inherited by all Actors. This is the most basic implementation calling the default constructor.

    FActorSpawnParameters SpawnInfo;
    SpawnInfo.Owner = this;
    SpawnInfo.Instigator = GetInstigator();
    SpawnInfo.ObjectFlags |= RF_Transient;
    YourActorReference = GetWorld()->SpawnActor(SpawnInfo);

Spawning has the associated structure FActorSpawnParameters which is used to pass in a number of parameters to the Spawn function as in this example.

GetWorld()->SpawnActor(YourActorClass, SpawnInfo);

The above lets you specify a class with YourActorClass you may wish this to be editable on children of this class.

See Spawning Actors in C++

Destroy

Archetypes

Replication

Blueprint

See Spawning and Destroying Actors in Blueprint

Spawn

Destroy

Archetypes

Replication

Replication Channels

Further Reading

Official Documentation

API AActor Class
Architecture Actors Gameframework
Editor Using Actors in Unreal Editor