AActor
#include "GameFramework/Actor.h"
Access: public
Specifiers: UCLASS
Description
The base class for all actors that can be placed or spawned in the world. AActor provides transform, component attachment, lifecycle events (BeginPlay, Tick, EndPlay), replication, and overlap/hit events. Every object you see or interact with in a level descends from AActor.
Signature
class AActor : public UObject Caveats & Gotchas
- • Actors must be spawned with `UWorld::SpawnActor<T>()`, not `NewObject<T>()`.
- • Component initialization order: constructor → InitializeComponent → BeginPlay. Do not rely on component state in the constructor.
- • NetMode checks (`HasAuthority()`, `IsLocallyControlled()`) are critical for multiplayer correctness.
- • Calling `Destroy()` does not immediately remove the actor — it defers removal to end-of-frame.
Examples
Minimal AActor subclass C++
UCLASS()
class MYGAME_API AMyActor : public AActor
{
GENERATED_BODY()
public:
AMyActor();
protected:
virtual void BeginPlay() override;
virtual void Tick(float DeltaTime) override;
private:
UPROPERTY(VisibleAnywhere)
UStaticMeshComponent* Mesh;
};
AMyActor::AMyActor()
{
PrimaryActorTick.bCanEverTick = true;
Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
RootComponent = Mesh;
} Spawning an actor C++
FActorSpawnParameters Params;
Params.Owner = this;
AMyActor* Spawned = GetWorld()->SpawnActor<AMyActor>(
AMyActor::StaticClass(),
FVector(0, 0, 100),
FRotator::ZeroRotator,
Params
); Functions (29)
Lifecycle 4 Transform 12 Components 1 Collision 4 Networking 1 Rendering 1 Utility 1 Actor 1 Transformation 4
Lifecycle 4 ▼
| Access | Type | Name |
|---|---|---|
| protected | function | AActor::BeginPlay |
| protected | function | AActor::EndPlay |
| public | function | AActor::TakeDamage |
| public | function | AActor::Tick |
Transform 12 ▼
| Access | Type | Name |
|---|---|---|
| public | function | AActor::GetActorLocation |
| public | function | AActor::GetActorScale |
| public | function | AActor::GetActorTransform |
| public | function | AActor::SetActorLocation |
| public | function | AActor::SetActorLocationAndRotation |
| public | function | AActor::ActorToWorld |
| public | function | AActor::AddActorLocalOffset |
| public | function | AActor::AddActorLocalRotation |
| public | function | AActor::AttachToActor |
| public | function | AActor::AttachToComponent |
| public | function | AActor::DetachFromActor |
| public | function | AActor::TeleportTo |
Components 1 ▼
| Access | Type | Name |
|---|---|---|
| public | function | AActor::GetComponentsByClass |
Collision 4 ▼
| Access | Type | Name |
|---|---|---|
| public | function | AActor::AddActorLocalTransform |
| public | function | AActor::GetOverlappingActors |
| public | function | AActor::GetOverlappingComponents |
| public | function | AActor::SetActorEnableCollision |
Networking 1 ▼
| Access | Type | Name |
|---|---|---|
| public | function | AActor::HasAuthority |
Rendering 1 ▼
| Access | Type | Name |
|---|---|---|
| public | function | AActor::SetActorHiddenInGame |
Utility 1 ▼
| Access | Type | Name |
|---|---|---|
| public | function | AActor::Destroy |
Actor 1 ▼
| Access | Type | Name |
|---|---|---|
| public | function | AActor::GetComponentByClass |
Transformation 4 ▼
| Access | Type | Name |
|---|---|---|
| public | function | AActor::GetActorForwardVector |
| public | function | AActor::GetActorRightVector |
| public | function | AActor::GetActorUpVector |
| public | function | AActor::GetDistanceTo |
Events & Delegates
See Also
Tags
Version History
Introduced in: 1.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
| 5.5 | stable | — |
Feedback
Was this helpful?