UActorFactory

Choose your operating system:

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,
    public IAssetFactoryInterface

Variables

Name Description

Public variable

uint32: 1

 

bShowInEditorQuickMenu

Whether to appear in the editor add actor quick menu

Public variable

uint32: 1

 

bUsePlacementExtent

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< AA...

 

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 Virtual

UObject *...

 

GetAssetFromActorInstance

(
    AActor* ActorInstance
)

Given an instance of an actor, find the wrapped asset object which can be used to create a valid FAssetData.

Public function Virtual

AActor *

 

GetDefaultActor

(
    const FAssetData& AssetData
)

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

Public function Virtual

UClass *

 

GetDefaultActorClass

(
    const FAssetData& AssetData
)

Initialize NewActorClass if necessary, and return that class.

Protected function Virtual Const

FString

 

GetDefaultActorLabel

(
    UObject* Asset
)

Get the default label that should be used for the actor spawned by the given asset (does not include any numeric suffix).

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 :

Overridden from IAssetFactoryInterface

Name Description

Public function Virtual

void

 

BeginPlacement

(
    const FPlacementOptions& InPlaceme...
)

Sets up any states that the factory needs to track across a placement call.

Public function Virtual

bool

 

CanPlaceElementsFromAssetData

(
    const FAssetData& InAssetData
)

Given an FAssetData, determine if this asset factory can place any elements.

Public function Virtual

void

 

EndPlacement

(
    TArrayView< const FTypedElementHand...,
    const FPlacementOptions& InPlaceme...
)

Tears down any state, or kicks off any rebuilds of data that this asset type may need.

Public function Virtual

UInstancedPl...

 

FactorySettingsObjectForPlacement

(
    const FAssetData& InAssetData,
    const FPlacementOptions& InPlaceme...
)

Returns the settings object which this factory will use to customize placement settings, based on the given placement information.

Public function Virtual

FAssetData

 

GetAssetDataFromElementHandle

(
    const FTypedElementHandle& InHandl...
)

Given an FTypedElementHandle, attempt to resolve the handle to the FAssetData which may have placed it.

Public function Virtual

TArray< FTyp...

 

PlaceAsset

(
    const FAssetPlacementInfo& InPlace...,
    const FPlacementOptions& InPlaceme...
)

Places the asset.

Public function Virtual

void

 

PostPlaceAsset

(
    TArrayView< const FTypedElementHand...,
    const FAssetPlacementInfo& InPlace...,
    const FPlacementOptions& InPlaceme...
)

Finalizes any placed elements based on adjustments the factory may need to do.

Public function Virtual

bool

 

PrePlaceAsset

(
    FAssetPlacementInfo& InPlacementIn...,
    const FPlacementOptions& InPlaceme...
)

Performs any final tweaking of the PlacementInfo that the asset factory may need to do.

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

Public function

UBlueprint &...

 

CreateBlueprint

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

This function is no longer used. See FKismetEditorUtilities::CreateBlueprint.

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