UActorComponent

Inheritance Hierarchy

Syntax

class UActorComponent :
    public UObject ,
    public IInterface_AssetUserData

Remarks

ActorComponent is the base class for components that define reusable behavior that can be added to different types of Actors. ActorComponents that have a transform are known as SceneComponents and those that can be rendered are PrimitiveComponents.

Variables

Name Description

Protected variable

TArray < UAssetU ...

 

AssetUserData

Array of user data stored with the component

Public variable

uint8 : 1

 

bAllowAnyoneToDestroyMe

Can this component be destroyed (via K2_DestroyComponent) by any parent

Public variable

uint8 : 1

 

bAllowConcurrentTick

Can we tick this concurrently on other threads?

Protected variable

uint8 : 1

 

bAllowReregistration

Check whether the component class allows reregistration during ReregisterAllComponents

Public variable

uint8 : 1

 

bAutoActivate

Whether the component is activated at creation or must be explicitly activated.

Public variable

uint8 : 1

 

bAutoRegister

Does this component automatically register with its owner

Protected variable

uint8 : 1

 

bCanEverAffectNavigation

Whether this component can potentially influence navigation

Public variable

uint8 : 1

 

bEditableWhenInherited

True if this component can be modified when it was inherited from a parent actor class

Public variable

uint8 : 1

 

bIsActive

Whether the component is currently active.

Public variable

uint8 : 1

 

bIsEditorOnly

If true, the component will be excluded from non-editor builds

Public variable

uint8 : 1

 

bNavigationRelevant

Cached navigation relevancy flag for collision updates

Protected variable

uint8 : 1

 

bNetAddressable

Is this component safe to ID over the network by name?

Public variable

uint8 : 1

 

bNeverNeedsRenderUpdate

If true, this component never needs a render update.

Protected variable

uint8 : 1

 

bPhysicsStateCreated

If the physics state is currently created for this component

Protected variable

uint8 : 1

 

bRegistered

Indicates if this ActorComponent is currently registered with a scene.

Protected variable

uint8 : 1

 

bRenderStateCreated

If the render state is currently created for this component

Protected variable

uint8 : 1

 

bReplicates

Is this component currently replicating? Should the network code consider it for replication? Owning Actor must be replicating first!

Public variable

uint8 : 1

 

bTickInEditor

Should this component be ticked in the editor

Public variable

uint8 : 1

 

bWantsInitializeComponent

If true, we call the virtual InitializeComponent

Public variable

TArray < FName >

 

ComponentTags

Array of tags that can be used for grouping and categorizing. Can also be accessed from scripting.

Public variable

EComponentCreat ...

 

CreationMethod

Describes how a component instance will be created

Public variable

FActorComponent ...

 

OnComponentActivated

Called when the component has been activated, with parameter indicating if it was from a reset

Public variable

FActorComponent ...

 

OnComponentDeactivated

Called when the component has been deactivated

Public variable

FActorComponent ...

 

PrimaryComponentTick

Main tick function for the Component

Constructors

Name Description

Public function

UActorComponent

(
    const FObjectInitializer & ObjectIn...
)

Default UObject constructor that takes an optional ObjectInitializer.

Functions

Name Description

Public function Virtual

void

 

Activate

(
    bool bReset
)

Activates the SceneComponent, should be overridden by native child classes.

Public function Virtual Const

UObject cons...

 

AdditionalStatObject()

Give a readable name for this component, including asset name if applicable

Public function Virtual

void

 

AddTickPrerequisiteActor

(
    AActor * PrerequisiteActor
)

Make this component tick after PrerequisiteActor

Public function Virtual

void

 

AddTickPrerequisiteComponent

(
    UActorComponent * PrerequisiteC...
)

Make this component tick after PrerequisiteComponent.

Public function Const

bool

 

AllowReregistration()

Check whether the component class allows reregistration during ReregisterAllComponents

Public function Virtual

void

 

ApplyWorldOffset

(
    const FVector & InOffset,
    bool bWorldShift
)

Called by owner actor on position shifting Component should update all relevant data structures to reflect new actor location

Public function Virtual

void

 

BeginPlay()

BeginsPlay for the component.

Public function Const

bool

 

CanEverAffectNavigation()

Can this component potentially influence navigation

Public function Virtual

void

 

CheckForErrors()

Function that gets called from within Map_Check to allow this actor component to check itself for any potential errors and register them with map check dialog.

Public function

void

 

ClearNeedEndOfFrameUpdate()

If we belong to a world, clear the request to do a deferred update.

Public function Const

bool

 

ComponentHasTag

(
    FName Tag
)

See if this component contains the supplied tag

Public function Const

bool

 

ComponentIsInLevel

(
    const ULevel * TestLevel
)

Returns true if this actor is contained by TestLevel.

Public function Const

bool

 

ComponentIsInPersistentLevel

(
    bool bIncludeLevelStreamingPersiste...
)

See if this component is in the persistent level

Public function

void

 

CreatePhysicsState()

Create any physics engine information for this component

Protected function Virtual

void

 

CreateRenderState_Concurrent()

Used to create any rendering thread information for this component

Public function Virtual

void

 

Deactivate()

Deactivates the SceneComponent.

Public function Virtual

void

 

DestroyComponent

(
    bool bPromoteChildren
)

Unregister the component, remove it from its outer Actor's Components array and mark for pending kill.

Public function

void

 

DestroyPhysicsState()

Shut down any physics engine structure for this component

Protected function Virtual

void

 

DestroyRenderState_Concurrent()

Used to shut down any rendering thread structure for this component

Public function

void

 

DetermineUCSModifiedProperties()

Initializes the list of properties that are modified by the UserConstructionScript

Public function

void

 

DoDeferredRenderUpdates_Concurrent()

Uses the bRenderStateDirty/bRenderTransformDirty to perform any necessary work on this component.

Public function Virtual

void

 

EndPlay

(
    const EEndPlayReason::Type EndPlayR...
)

Ends gameplay for this component.

Public function Virtual Const

bool

 

GetComponentClassCanReplicate()

Returns true if this type of component can ever replicate, override to disable the default behavior

Public function Virtual Const

TStructOnSco ...

 

GetComponentInstanceData()

Called before we throw away components during RerunConstructionScripts, to cache any data we wish to persist across that operation

Public function Const

ULevel *

 

GetComponentLevel()

Return the ULevel that this Component is part of.

Public function Const

float

 

GetComponentTickInterval()

Returns the tick interval for this component's primary tick function, which is the frequency in seconds at which it will be executed

Public function Virtual

TSharedPtr < ...

 

GetCustomEditorPreviewWidget()

If this component is set up to provide a preview window in editor (see GetEditorPreviewInfo), you can use this to customize the preview (to be something other than a world viewport).

Public function Virtual

bool

 

GetEditorPreviewInfo

(
    float DeltaTime,
    FMinimalViewInfo & ViewOut
)

Supplies the editor with a view specific to this component (think a view from a camera components POV, a render, etc.).

Public function Const

bool

 

GetIsReplicated()

Returns whether replication is enabled or not.

Public function Const

uint32

 

GetMarkedForEndOfFrameUpdateState()

Tracks whether the component has been added to one of the world's end of frame update lists

Public function Const

ENetMode

 

GetNetMode()

Get the network mode (dedicated server, client, standalone, etc) for this component.

Public function Const

AActor *

 

GetOwner()

Follow the Outer chain to get the AActor that 'Owns' this component

Public function Const

ENetRole

 

GetOwnerRole()

Get the network role of the Owner, or ROLE_None if there is no owner.

Public function Virtual Const

FString

 

GetReadableName()

Returns a readable name for this component, including the asset name if applicable By default this appends a space plus AdditionalStatObject()

Public function Const

FSceneInterf ...

 

GetScene()

Returns the rendering scene associated with this component

Public function Const

void

 

GetUCSModifiedProperties

(
    TSet < const UProperty * >& Mod...
)

Returns the list of properties that are modified by the UserConstructionScript

Public function Virtual Const

UWorld *

 

GetWorld()

Getter for the cached world pointer, will return null if the component is not actually spawned in a level

Protected function

void

 

HandleCanEverAffectNavigationChange

(
    bool bForceUpdate
)

Makes sure navigation system has up to date information regarding component's navigation relevancy and if it can affect navigation at all

Public function Const

bool

 

HasBeenCreated()

Indicates that OnCreatedComponent has been called, but OnDestroyedComponent has not yet

Public function Const

bool

 

HasBeenInitialized()

Indicates that InitializeComponent has been called, but UninitializeComponent has not yet

Public function Const

bool

 

HasBegunPlay()

Indicates that BeginPlay has been called, but EndPlay has not yet

Protected function Virtual Const

bool

 

HasValidPhysicsState()

Used to check that DestroyPhysicsState() is working correctly

Public function Virtual

void

 

InitializeComponent()

Initializes the component.

Public function

void

 

InvalidateLightingCache()

Invalidate lighting cache with default options.

Public function Virtual

void

 

InvalidateLightingCacheDetailed

(
    bool bInvalidateBuildEnqueuedLighti...,
    bool bTranslationOnly
)

Called when this actor component has moved, allowing it to discard statically cached lighting information.

Public function Virtual Const

bool

 

IsActive()

Returns whether the component is active or not

Public function Const

bool

 

IsBeingDestroyed()

Returns whether the component is in the process of being destroyed.

Public function Virtual Const

bool

 

IsComponentTickEnabled()

Returns whether this component has tick enabled or not

Public function Const

bool

 

IsCreatedByConstructionScript()

Returns true if instances of this component are created by either the user or simple construction script

Public function Const

bool

 

IsEditableWhenInherited()

True if this component can be modified when it was inherited from a parent actor class

Public function Virtual Const

bool

 

IsNavigationRelevant()

Override to specify that a component is relevant to the navigation system

Public function Const

bool

 

IsNetMode

(
    ENetMode Mode
)

Test whether net mode is the given mode.

Public function Const

bool

 

IsNetSimulating()

Returns true if we are replicating and this client is not authoritative

Public function Const

bool

 

IsNetStartupComponent()

Returns true if this component was owned by a net startup actor during level load.

Public function Const

bool

 

IsOwnerRunningUserConstructionScript()

See if the owning Actor is currently running the UCS

Public function Const

bool

 

IsOwnerSelected()

Returns whether the component's owner is selected in the editor

Public function Const

bool

 

IsPhysicsStateCreated()

Returns true if the physics 'state' (e.g. physx bodies) are created for this component

Public function Virtual Const

bool

 

IsReadyForOwnerToAutoDestroy()

Overridable check for a component to indicate to its Owner that it should prevent the Actor from auto destroying when finished

Public function Const

bool

 

IsRegistered()

See if this component is currently registered

Public function Const

bool

 

IsRenderStateCreated()

Returns true if the render 'state' (e.g. scene proxy) is created for this component

Public function Const

bool

 

IsRenderStateDirty()

Is this component in need of its whole state being sent to the renderer?

Public function Const

bool

 

IsRenderTransformDirty()

Is this component's transform in need of sending to the renderer?

Public function Const

bool

 

IsVisualizationComponent()

Returns true if this component is only used for visualization, usually a sprite or text

Public function

void

 

K2_DestroyComponent

(
    UObject * Object
)

Unregister and mark for pending kill a component.

Public function

void

 

MarkForNeededEndOfFrameRecreate()

If we belong to a world, mark this for a deferred update, otherwise do it now.

Public function

void

 

MarkForNeededEndOfFrameUpdate()

If we belong to a world, mark this for a deferred update, otherwise do it now.

Public function

void

 

MarkRenderDynamicDataDirty()

Indicate that dynamic data for this component needs to be sent at the end of the frame.

Public function

void

 

MarkRenderStateDirty()

Mark the render state as dirty - will be sent to the render thread at the end of the frame.

Public function

void

 

MarkRenderTransformDirty()

Marks the transform as dirty - will be sent to the render thread at the end of the frame

Public function Virtual

void

 

OnActorEnableCollisionChanged()

Called on each component when the Actor's bEnableCollisionChanged flag changes

Public function Virtual

void

 

OnComponentCreated()

Called when a component is created (not loaded). This can happen in the editor or during gameplay

Public function Virtual

void

 

OnComponentDestroyed

(
    bool bDestroyingHierarchy
)

Called when a component is destroyed

Protected function Virtual

void

 

OnCreatePhysicsState()

Used to create any physics engine information for this component

Protected function Virtual

void

 

OnDestroyPhysicsState()

Used to shut down and physics engine structure for this component

Protected function Virtual

void

 

OnRegister()

Called when a component is registered, after Scene is set, but before CreateRenderState_Concurrent or OnCreatePhysicsState are called.

Public function Virtual

void

 

OnRep_IsActive()

Handles replication of active state, handles ticking by default but should be overridden as needed

Protected function Virtual

void

 

OnUnregister()

Called when a component is unregistered.

Public function Virtual

void

 

PreReplication

(
    IRepChangedPropertyTracker & Change...
)

Called on the component right before replication occurs

Public function

void

 

ReceiveBeginPlay()

Blueprint implementable event for when the component is beginning play, called before its owning actor's BeginPlay or when the component is dynamically created if the Actor has already BegunPlay.

Public function

void

 

ReceiveEndPlay

(
    EEndPlayReason::Type EndPlayReason
)

Blueprint implementable event for when the component ends play, generally via destruction or its Actor's EndPlay.

Public function

void

 

ReceiveTick

(
    float DeltaSeconds
)

Event called every frame if tick is enabled

Public function

void

 

RecreatePhysicsState()

Recreate the physics state right way.

Public function

void

 

RecreateRenderState_Concurrent()

Recreate the render state right away.

Public function

void

 

RegisterAllComponentTickFunctions

(
    bool bRegister
)

When called, will call the virtual call chain to register all of the tick functions Do not override this function or make it virtual

Public function

void

 

RegisterComponent()

Register this component, creating any rendering/physics state.

Protected function Virtual

void

 

RegisterComponentTickFunctions

(
    bool bRegister
)

Virtual call chain to register all tick functions

Public function

void

 

RegisterComponentWithWorld

(
    UWorld * InWorld
)

Registers a component with a specific world, which creates any visual/physical state

Public function Virtual

void

 

RemoveTickPrerequisiteActor

(
    AActor * PrerequisiteActor
)

Remove tick dependency on PrerequisiteActor.

Public function Virtual

void

 

RemoveTickPrerequisiteComponent

(
    UActorComponent * PrerequisiteC...
)

Remove tick dependency on PrerequisiteComponent.

Public function

void

 

RemoveUCSModifiedProperties

(
    const TArray < UProperty * >& P...
)

Removes specified properties from the list of UCS-modified properties

Public function Virtual

bool

 

ReplicateSubobjects

(
    UActorChannel * Channel,
    FOutBunch * Bunch,
    FReplicationFlags * RepFlags
)

Allows a component to replicate other subobject on the actor

Public function Virtual Const

bool

 

RequiresGameThreadEndOfFrameRecreate()

Return true if this component requires end of frame recreates to happen from the game thread.

Public function Virtual Const

bool

 

RequiresGameThreadEndOfFrameUpdates()

Return true if this component requires end of frame updates to happen from the game thread.

Public function

void

 

ReregisterComponent()

Unregisters and immediately re-registers component. Handles bWillReregister properly.

Protected function Virtual

void

 

SendRenderDynamicData_Concurrent()

Called to send dynamic data for this component to the rendering thread

Protected function Virtual

void

 

SendRenderTransform_Concurrent()

Called to send a transform update for this component to the rendering thread

Public function Virtual

void

 

SetActive

(
    bool bNewActive,
    bool bReset
)

Sets whether the component is active or not

Public function Virtual

void

 

SetAutoActivate

(
    bool bNewAutoActivate
)

Sets whether the component should be auto activate or not. Only safe during construction scripts.

Public function

void

 

SetCanEverAffectNavigation

(
    bool bRelevant
)

Set value of bCanEverAffectNavigation flag and update navigation octree if needed

Public function Virtual

void

 

SetComponentTickEnabled

(
    bool bEnabled
)

Set this component's tick functions to be enabled or disabled.

Public function Virtual

void

 

SetComponentTickEnabledAsync

(
    bool bEnabled
)

Spawns a task on GameThread that will call SetComponentTickEnabled

Public function

void

 

SetComponentTickInterval

(
    float TickInterval
)

Sets the tick interval for this component's primary tick function.

Public function

void

 

SetIsNetStartupComponent

(
    const bool bInIsNetStartupComponent
)

This should only be called by the engine in ULevel::InitializeNetworkActors to initialize bIsNetStartupComponent.

Public function

void

 

SetIsReplicated

(
    bool ShouldReplicate
)

Enable or disable replication.

Public function

void

 

SetIsVisualizationComponent

(
    const bool bInIsVisualizationCompon...
)

Sets if this component is only used for visualization

Public function

void

 

SetNetAddressable()

This signifies the component can be ID'd by name over the network.

Public function

void

 

SetTickableWhenPaused

(
    bool bTickableWhenPaused
)

Sets whether this component can tick when paused.

Public function

void

 

SetTickGroup

(
    ETickingGroup NewTickGroup
)

Changes the ticking group for this component

Public function

bool

 

SetupActorComponentTickFunction

(
    FTickFunction * TickFunction
)

Set up a tick function for a component in the standard way.

Protected function Virtual Const

bool

 

ShouldActivate()

Return true if this component is in a state where it can be activated normally.

Protected function Virtual Const

bool

 

ShouldCreatePhysicsState()

Return true if CreatePhysicsState() should be called.

Protected function Virtual Const

bool

 

ShouldCreateRenderState()

Return true if CreateRenderState() should be called

Public function Virtual

void

 

TickComponent

(
    float DeltaTime,
    enum ELevelTick TickType,
    FActorComponentTickFunction * T...
)

Function called every frame on this ActorComponent.

Public function Virtual

void

 

ToggleActive()

Toggles the active state of the component

Public function Virtual

void

 

UninitializeComponent()

Handle this component being Uninitialized.

Public function

void

 

UnregisterComponent()

Unregister this component, destroying any rendering/physics state.

Public function Virtual

void

 

UpdateComponentToWorld

(
    EUpdateTransformFlags UpdateTransfo...,
    ETeleportType Teleport
)

Recalculate the value of our component to world transform

Overridden from UObject

Name Description

Public function Virtual

void

 

BeginDestroy()

Called before destroying the object.

Public function Virtual

bool

 

CallRemoteFunction

(
    UFunction * Function,
    void* Parms,
    FOutParmRec * OutParms,
    FFrame * Stack
)

Call the actor's function remotely

Public function Virtual

int32

 

GetFunctionCallspace

(
    UFunction * Function,
    void* Parameters,
    FFrame * Stack
)

Return the space this function should be called.

Public function Virtual Const

void

 

GetLifetimeReplicatedProps

(
    TArray < FLifetimeProperty >& OutLi...
)

Returns properties that are replicated for the lifetime of the actor channel

Public function Virtual Const

bool

 

IsEditorOnly()

Returns whether this component is an editor-only object or not

Public function Virtual Const

bool

 

IsNameStableForNetworking()

IsNameStableForNetworking means an object can be referred to its path name (relative to outer) over the network

Public function Virtual Const

bool

 

IsSelectedInEditor()

Test the selection state of a UObject

Public function Virtual Const

bool

 

IsSupportedForNetworking()

IsSupportedForNetworking means an object can be referenced over the network

Public function Virtual

void

 

MarkAsEditorOnlySubobject()

Called during component creation to mark this component as editor only

Public function Virtual

bool

 

Modify

(
    bool bAlwaysMarkDirty
)

Note that the object will be modified.

Public function Virtual Const

bool

 

NeedsLoadForClient()

Called during saving to determine the load flags to save with the object.

Public function Virtual Const

bool

 

NeedsLoadForEditorGame()

Called during saving to include this object in client/servers running in editor builds, even if they wouldn't normally be.

Public function Virtual Const

bool

 

NeedsLoadForServer()

Called during saving to determine the load flags to save with the object.

Public function Virtual

void

 

PostEditChangeChainProperty

(
    FPropertyChangedChainEvent & Proper...
)

This alternate version of PostEditChange is called when properties inside structs are modified.

Public function Virtual

void

 

PostEditChangeProperty

(
    FPropertyChangedEvent & PropertyCha...
)

Called when a property on this object has been modified externally

Public function Virtual

void

 

PostEditUndo()

Called after applying a transaction to the object.

Public function Virtual

void

 

PostInitProperties()

Called after the C++ constructor and after the properties have been initialized, including those loaded from config.

Public function Virtual

void

 

PostLoad()

Do any object-specific cleanup required immediately after loading an object.

Public function Virtual

void

 

PostRename

(
    UObject * OldOuter,
    const FName OldName
)

Called at the end of Rename() , but only if the rename was actually carried out

Public function Virtual

void

 

PreEditChange

(
    UProperty * PropertyAboutToChan...
)

This is called when a property is about to be modified externally

Public function Virtual

void

 

PreEditUndo()

Called before applying a transaction to the object.

Public function Virtual

bool

 

Rename

(
    const TCHAR * NewName,
    UObject * NewOuter,
    ERenameFlags Flags
)

Rename this object to a unique name, or change its outer.

Public function Virtual

void

 

Serialize

(
    FArchive & Ar
)

Handles reading, writing, and reference collecting using FArchive .

Overridden from IInterface_AssetUserData

Name Description

Public function Virtual

void

 

AddAssetUserData

(
    UAssetUserData * InUserData
)

Public function Virtual

UAssetUserDa ...

 

GetAssetUserDataOfClass

(
    TSubclassOf < UAssetUserData > InUse...
)

Public function Virtual

void

 

RemoveUserDataOfClass

(
    TSubclassOf < UAssetUserData > InUse...
)

Constants

Name

Description

ComponentTemplateNameSuffix

Prefix used to identify template component instances

GlobalCreatePhysicsDelegate

Create component physics state global delegate.

GlobalDestroyPhysicsDelegate

Destroy component physics state global delegate.

Deprecated Variables

Name Description

Public variable

uint8 : 1

 

bCreatedByConstructionScript_DEPRECATED

Replaced by CreationMethod

Public variable

uint8 : 1

 

bInstanceComponent_DEPRECATED

Replaced by CreationMethod

Public variable

uint8 : 1

 

bWantsBeginPlay

bWantsBeginPlay was inconsistently enforced and is now unused. BeginPlay will now always be called for Actor Components.

See Also

References

Module

Engine

Header

Runtime/Engine/Classes/Components/ActorComponent.h