UActorFactory

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

UnrealEd

Header

/Engine/Source/Editor/UnrealEd/Classes/ActorFactories/ActorFactory.h

Include

#include "ActorFactories/ActorFactory.h"

Syntax

class UActorFactory : public UObject

Variables

Name Description

Public variable

uint32: 1

 

bShowInEditorQuickMenu

Whether to appear in the editor add actor quick menu

Public variable

uint32: 1

 

bUseSurfaceOrientation

Public variable

FText

 

DisplayName

Name used as basis for 'New Actor' menu.

Public variable

int32

 

MenuPriority

Indicates how far up the menu item should be. The higher the number, the higher up the list.

Public variable

TSubclassOf< cl...

 

NewActorClass

AActor subclass this ActorFactory creates.

Public variable

FString

 

NewActorClassName

Name of actor subclass this actorfactory creates - dynamically loaded. Overrides NewActorClass.

Public variable

FVector

 

SpawnPositionOffset

Translation applied to the spawn position.

Constructors

Name Description

Public function

UActorFactory

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function Virtual Const

FQuat

 

AlignObjectToSurfaceNormal

(
    const FVector& InSurfaceNormal,
    const FQuat& ActorRotation
)

Return a quaternion which aligns this actor type to the specified surface normal

Public function Virtual

bool

 

CanCreateActorFrom

(
    const FAssetData& AssetData,
    FText& OutErrorMsg
)

Public function

AActor *

 

CreateActor

(
    UObject* InAsset,
    ULevel* InLevel,
    const FTransform& InTransform,
    const FActorSpawnParameters& InSpa...
)

Public function

UBlueprint &...

 

CreateBlueprint

(
    UObject* Instance,
    UObject* Outer,
    const FName Name,
    const FName CallingContext
)

Called to create a blueprint class that can be used to spawn an actor from this factory

Public function Virtual

UObject *...

 

GetAssetFromActorInstance

(
    AActor* ActorInstance
)

Given an instance of an actor pertaining to this factory, find the asset that should be used to create a new actor

Public function Virtual

AActor *

 

GetDefaultActor

(
    const FAssetData& AssetData
)

Initialize NewActorClass if necessary, and return default actor for that class.

Public function

UClass *

 

GetDefaultActorClass

(
    const FAssetData& AssetData
)

Initialize NewActorClass if necessary, and return that class.

Public function Const

FText

 

GetDisplayName()

Name to put on context menu.

Protected function Virtual

void

 

PostCreateBlueprint

(
    UObject* Asset,
    AActor* CDO
)

Override this in derived factory classes if needed.

Protected function Virtual

void

 

PostSpawnActor

(
    UObject* Asset,
    AActor* NewActor
)

Subclasses may implement this to modify the actor after it has been spawned IMPORTANT: If you override this, you should usually also override PostCreateBlueprint()!

Protected function Virtual

bool

 

PreSpawnActor

(
    UObject* Asset,
    FTransform& InOutLocation
)

Protected function Virtual

AActor *

 

SpawnActor

(
    UObject* InAsset,
    ULevel* InLevel,
    const FTransform& InTransform,
    const FActorSpawnParameters& InSpa...
)

Protected function Const

ULevel *

 

ValidateSpawnActorLevel

(
    ULevel* InLevel,
    const FActorSpawnParameters& InSpa...
)

Validates the input params for SpawnActor and returns the appropriate level to use depending on whether InLevel and/or InSpawnParams.OverrideLevel is passed :

Deprecated Functions

Name Description

Public function

AActor *

 

CreateActor

(
    UObject* Asset,
    ULevel* InLevel,
    const FTransform& Transform,
    EObjectFlags InObjectFlags,
    const FName InName
)

This function has been deprecated in favor of the other version that takes a FActorSpawnParameters in parameter

Protected function Virtual

AActor *

 

SpawnActor

(
    UObject* Asset,
    ULevel* InLevel,
    const FTransform& Transform,
    EObjectFlags ObjectFlags,
    const FName Name
)

This function has been deprecated in favor of the other version that takes a FActorSpawnParameters in parameter

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss