MActorComponent
- Module
- Game
- Header
#include "Game/MActorComponent.h"- Namespace
Mowo- Reflection
- Reflected by MowoHeaderTool
Properties
| Type | Name | Description |
|---|---|---|
bool | tickEnabled | Tick gate — set to false to skip TickComponent without disabling the component. Cheaper than detaching/reattaching for things that only sometimes need ticking (e.g. an AI component that's only active while the player is nearby). Default true. |
float | tickInterval | Tick pacing (UE TickInterval): 0 = every frame. When set, the owning actor accumulates time and TickComponent fires with the ACCUMULATED delta once the interval elapses. Default 0.0f. |
int32_t | tickGroupOverride | Per-component tick group override. -1 (default) = tick inside the owner's Tick, in the owner's group. 0..3 = AActor::ETickGroup values (PrePhysics/DuringPhysics/PostPhysics/PostUpdateWork): the world then ticks this component in THAT group's pass instead — after every actor of the group has ticked. An int rather than the enum so this header keeps its forward-declared AActor. Default -1. |
Constructors
| Signature | Name | Description |
|---|---|---|
MActorComponent() = default | MActorComponent | |
~MActorComponent() override = default | ~MActorComponent |
Public functions
| Returns | Name | Description |
|---|---|---|
void | OnRegister | Lifecycle — AActor dispatches. |
void | BeginPlay | |
void | TickComponent | |
void | EndPlay | |
void | PullFromMirror | Inverse of the OnRegister push, run when an actor adopts an entity the scene loader already populated: read exactly the mirrored fields the push writes, before serialized actor deltas apply. |
void | RefreshMirror | Re-publish the fields a component mirrors onto the ECS (its light, mesh, audio, ...). |
AActor* | GetOwner | Owning actor — set by AActor::AddComponent when the component is attached. |
void | SetOwner | Out-of-line: the TObjectPtr store barrier needs the complete type, and AActor is only forward-declared here. |
bool | IsTransient | Created by an editor-time actor for preview: AActor::ClearGeneratedContent removes it. |
void | SetTransient | |
bool | IsInstanceComponent | True for a component a designer added to this placed actor in the editor (FInstanceComponents), as opposed to one the class constructor creates. |
void | SetInstanceComponent | |
bool | AdvanceTickAccumulator | Called by the owning actor's Tick: applies tickInterval pacing. |
Function details
MActorComponent
MActorComponent() = default~MActorComponent
~MActorComponent() override = defaultOnRegister
virtual void OnRegister()Lifecycle — AActor dispatches. OnRegister publishes the component's ECS mirror. It runs when the actor joins a world, which is scene load in the editor — a placed actor is therefore visible and inspectable without playing. Put everything that only describes the actor here: it must be safe to run in the editor, must not spawn actors, and must not start anything that ticks. BeginPlay runs when the world begins play (PIE Play, or the first MWorld::Tick on a headless driver) and once per actor. Put gameplay startup here — playing audio, spawning a camera rig, seeding runtime state from config.
BeginPlay
virtual void BeginPlay()TickComponent
virtual void TickComponent(float deltaSeconds)EndPlay
virtual void EndPlay()PullFromMirror
virtual void PullFromMirror(World* ecs, EntityID entity)Inverse of the OnRegister push, run when an actor adopts an entity the scene loader already populated: read exactly the mirrored fields the push writes, before serialized actor deltas apply.
RefreshMirror
virtual void RefreshMirror()Re-publish the fields a component mirrors onto the ECS (its light, mesh, audio, ...). Each mirroring component overrides it; the base has nothing to push. Virtual so a writer that only knows the component — a script's property setter — can refresh what the renderer reads after a raw write.
GetOwner
AActor* GetOwner() constOwning actor — set by AActor::AddComponent when the component is attached. nullptr for unattached/orphaned components.
SetOwner
void SetOwner(AActor* owner)Out-of-line: the TObjectPtr store barrier needs the complete type, and AActor is only forward-declared here.
IsTransient
bool IsTransient() const noexceptCreated by an editor-time actor for preview: AActor::ClearGeneratedContent removes it. Components are never saved by composition (the class constructor owns that), so this only marks what regeneration may drop; visible generated geometry belongs on a transient actor, whose ECS mirror is kept out of the level file as well.
SetTransient
void SetTransient(bool transient) noexceptIsInstanceComponent
bool IsInstanceComponent() constTrue for a component a designer added to this placed actor in the editor (FInstanceComponents), as opposed to one the class constructor creates. The serializer writes only these components' existence: constructor components come back with the class.
SetInstanceComponent
void SetInstanceComponent(bool value)AdvanceTickAccumulator
bool AdvanceTickAccumulator(float deltaSeconds, float& outDelta)Called by the owning actor's Tick: applies tickInterval pacing. Returns false to skip this frame; on true, outDelta carries the accumulated dt to tick with.