class

MWorld

MWorld is a GC root: the mark phase reaches every spawned actor through the MPROPERTY m_actors list (and from there components via the actors' own MPROPERTY fields). An actor's Outer pointing at the world does NOT keep the actor alive — only the m_actors edge does.

Module
Game
Header
#include "Game/MWorld.h"
Namespace
Mowo
Reflection
Reflected by MowoHeaderTool

Constructors

SignatureNameDescription
MWorld()MWorld
~MWorld() override~MWorld
MWorld(const MWorld&) = deleteMWorld

Public functions

ReturnsNameDescription
MWorld&operator=
TWeakObjectPtr<T>SpawnActorSpawning Construct + register an actor in this world.
AActor*SpawnActorByClassSpawn by runtime class (hot-reload restore, scene-deserialized actors).
AActor*SpawnActorFromTemplateSpawn an instance of a registered template (archetype instancing).
AGameMode*InitializeGameModeGame framework Spawn the game mode (cls, or base AGameMode when null), call InitGame + StartMatch.
AGameMode*GetGameMode
voidBeginPlayRegistration and play are separate transitions.
voidEndPlay
boolHasBegunPlay
voidTickLifecycle Whole-frame tick: BeginTickFrame, all four groups in order, then SyncActorTransforms.
voidBeginTickFrameThe frame-ordered pieces of Tick, so the caller can interleave a physics step.
voidTickGroup
FTimerManager&GetTimerManagerWorld-scoped timers (UE parity): set here, a timer dies WITH the world — it can never fire into a torn-down actor the way an engine-scope FTimerManager::Get() timer can.
floatGetTimeSecondsTime (UWorld parity).
floatGetRealTimeSeconds
floatGetDeltaSeconds
uint64_tGetFrameNumber
floatTimeSinceGame seconds since a stamp taken from GetTimeSeconds().
floatGetTimeDilation
voidSetTimeDilation
floatGetEffectiveTimeDilationThe dilation actually applied to this frame's tick delta: zero while paused.
boolIsPaused
voidSetPaused
voidSetWorldPausedPer-WORLD pause/dilation — a second axis on top of the process-global FTime clock the methods above mirror (TimeTests pins that mirroring).
boolIsWorldPaused
voidSetWorldTimeDilation
floatGetWorldTimeDilation
voidSyncActorTransformsPush each actor's root world transform into its backing entity.
voidDestroyDespawn an actor: calls EndPlay, removes it from the list, deletes it.
boolEjectActor
boolAdoptActor
voidNotifyBackingEntityDestroyedThe scene deleted an entity out from under its actor (outliner delete): tear the actor down too, without re-entering the entity destruction hooks.
const std::vector<AActor*>&GetActorsRemoval leaves a null hole so it costs no search and no shift; the holes are squeezed out here and once a frame by the tick schedule, so a caller never sees one.
voidInvalidateTickListsThe tick schedule is rebuilt once a frame from canEverTick, primaryTickGroup and the components' tickGroupOverride, which are plain fields.
voidNotifyActorComponentAddedAActor::AddComponent reports here so a component added mid-frame with a tickGroupOverride still ticks in this frame's pass, as it did when every pass walked the whole actor list.
AActor*FindActorByEntityResolve the actor backing an ECS entity, or nullptr when the entity is plain ECS data (or its actor is pending kill).
World*GetECSWorldECS bridge Backing ECS world — systems that prefer flat iteration of typed components read from here.
voidSetECSWorldAlso tells FViewerRegistry, so a scene system holding only the ECS world can still ask where the viewers are.
EWorldTypeGetWorldTypeWorld type.
voidSetWorldType
boolIsEditorWorldThe level as authored: actors here tick only through TickInEditor.
boolIsPlayWorldA world that plays: a PIE copy or a game.
voidTickInEditorEdit-mode tick: gives each actor that opted in (AActor::ShouldTickInEditor) one TickInEditor(dt), round-robin from where the previous frame stopped, and stops early once ed.TickBudgetMs is spent, so a slow generator cannot stall the editor frame; the actors it skipped run first next frame.
const FEditorTickStats&GetEditorTickStats
voidAddPinWire
voidClearPinWires
const std::vector<FPinWire>&GetPinWires
voidFirePin
voidSetBackingEntityHooks
T*GetSubsystemWorld subsystems (UE-style) Auto-instanced MWorldSubsystem singletons.

Function details

MWorld

C++
MWorld()

~MWorld

C++
~MWorld() override

MWorld

C++
MWorld(const MWorld&) = delete

operator=

C++
MWorld& operator=(const MWorld&) = delete

SpawnActor

C++
template<typename T, typename... Args> TWeakObjectPtr<T> SpawnActor(Args&&... args)

Spawning Construct + register an actor in this world. The world becomes the actor's outer; BeginPlay fires (or is queued if tick is mid-frame). Returns a TWeakObjectPtr so callers can detect post-GC sweep — DON'T store as raw AActor*.

SpawnActorByClass

C++
AActor* SpawnActorByClass(MClass* cls, const std::function<void(AActor*)>& preRegister = {}, const FActorSpawnTransform* initialTransform = nullptr)

Spawn by runtime class (hot-reload restore, scene-deserialized actors). Returns nullptr when cls is null, lacks a codegen factory, or isn't an AActor subclass. preRegister runs after construction (default subobjects exist) but BEFORE RegisterActor — restore property values there so the ECS mirror publishes them. initialTransform is applied during registration, ahead of OnConstruct and BeginPlay: onto the root component when the actor has one, else onto the backing TransformComponent the moment it exists.

SpawnActorFromTemplate

C++
AActor* SpawnActorFromTemplate(FName templateName, const std::function<void(AActor*)>& preRegister = {}, const FActorSpawnTransform* initialTransform = nullptr)

Spawn an instance of a registered template (archetype instancing). The instance derives its defaults from the template rather than the class CDO and remembers the template's name, so the scene writer diffs it against the template. Returns nullptr when the template is not registered in FActorTemplateRegistry.

InitializeGameMode

C++
AGameMode* InitializeGameMode(MClass* gameModeClass = nullptr, bool spawnLocalPlayer = true)

Game framework Spawn the game mode (cls, or base AGameMode when null), call InitGame + StartMatch. One per world; repeated calls return the existing mode. Typically invoked by the runtime after the start scene loads, with the class named in project settings. spawnLocalPlayer false = dedicated server: no local PlayerController or default pawn; connections get pawns through AGameMode::RestartPlayer.

GetGameMode

C++
AGameMode* GetGameMode() const

BeginPlay

C++
void BeginPlay()

Registration and play are separate transitions. Registering an actor publishes its ECS mirror — that is what makes a placed actor visible and inspectable in the editor, and it happens at scene load. BeginPlay fans out only here, when the host enters play (Scene::OnRuntimeStart / OnSimulationStart). Both are idempotent and each actor begins play at most once per play session: an actor spawned mid-play begins play during its registration and is skipped by a later world BeginPlay, and a Play → Stop → Play cycle re-runs BeginPlay exactly once per cycle.

EndPlay

C++
void EndPlay()

HasBegunPlay

C++
bool HasBegunPlay() const noexcept

Tick

C++
void Tick(float deltaSeconds)

Lifecycle Whole-frame tick: BeginTickFrame, all four groups in order, then SyncActorTransforms. Correct only when nothing needs to run BETWEEN groups — a host that steps physics mid-frame drives the pieces below instead (Scene::OnUpdateRuntime does exactly that, so PostPhysics actors observe post-physics poses). Begins play first when it has not begun. This path is a game path by construction — an editor host drives the pieces below and calls BeginPlay itself — so a headless driver that only ticks still gets the lifecycle it expects rather than silently unplayed actors.

BeginTickFrame

C++
void BeginTickFrame()

The frame-ordered pieces of Tick, so the caller can interleave a physics step. Call order per frame: BeginTickFrame → TickGroup (PrePhysics) → TickGroup(DuringPhysics) → SyncActorTransforms(false) → physics → TickGroup(PostPhysics) → TickGroup(PostUpdateWork) → SyncActorTransforms(true). BeginTickFrame advances the frame stamp the prerequisite resolver dedups against — exactly once per frame, never per group.

TickGroup

C++
void TickGroup(AActor::ETickGroup group, float deltaSeconds)

GetTimerManager

C++
FTimerManager& GetTimerManager()

World-scoped timers (UE parity): set here, a timer dies WITH the world — it can never fire into a torn-down actor the way an engine-scope FTimerManager::Get() timer can. Ticked at the start of the PrePhysics group, so it pauses when the world stops ticking.

GetTimeSeconds

C++
float GetTimeSeconds() const

Time (UWorld parity). All of it reads the process frame clock in Core — a world does not own a clock, it presents one — so the numbers agree with FTime, FApp and every other module that asks. Defined out of line so a caller in another DLL resolves them here rather than inlining its own read.

GetRealTimeSeconds

C++
float GetRealTimeSeconds() const

GetDeltaSeconds

C++
float GetDeltaSeconds() const

GetFrameNumber

C++
uint64_t GetFrameNumber() const

TimeSince

C++
float TimeSince(float gameTimeSeconds) const

Game seconds since a stamp taken from GetTimeSeconds(). Does not advance while paused.

GetTimeDilation

C++
float GetTimeDilation() const

SetTimeDilation

C++
void SetTimeDilation(float dilation)

GetEffectiveTimeDilation

C++
float GetEffectiveTimeDilation() const

The dilation actually applied to this frame's tick delta: zero while paused.

IsPaused

C++
bool IsPaused() const

SetPaused

C++
void SetPaused(bool paused)

SetWorldPaused

C++
void SetWorldPaused(bool paused)

Per-WORLD pause/dilation — a second axis on top of the process-global FTime clock the methods above mirror (TimeTests pins that mirroring). This axis lets two worlds differ: a paused PIE world under a live editor world, a slow-motion cutscene world beside a real-time UI world. Applied inside TickGroup, so both MWorld::Tick and hosts that drive TickGroup directly (Scene::OnUpdateRuntime) honour it; a paused world fires no timers and ticks no actors.

IsWorldPaused

C++
bool IsWorldPaused() const

SetWorldTimeDilation

C++
void SetWorldTimeDilation(float dilation)

GetWorldTimeDilation

C++
float GetWorldTimeDilation() const

SyncActorTransforms

C++
void SyncActorTransforms(bool onlyChanged = false)

Push each actor's root world transform into its backing entity. onlyChanged writes only actors whose root moved since the previous sync this frame — which is what lets the post-physics sync land PostPhysics actor movement WITHOUT clobbering the poses physics just wrote for actors that did not move themselves.

Destroy

C++
void Destroy(AActor* actor)

Despawn an actor: calls EndPlay, removes it from the list, deletes it.

EjectActor

C++
bool EjectActor(AActor* actor)

AdoptActor

C++
bool AdoptActor(AActor* actor)

NotifyBackingEntityDestroyed

C++
void NotifyBackingEntityDestroyed(EntityID entity)

The scene deleted an entity out from under its actor (outliner delete): tear the actor down too, without re-entering the entity destruction hooks. No-op for plain entities.

GetActors

C++
const std::vector<AActor*>& GetActors() const

Removal leaves a null hole so it costs no search and no shift; the holes are squeezed out here and once a frame by the tick schedule, so a caller never sees one.

InvalidateTickLists

C++
void InvalidateTickLists()

The tick schedule is rebuilt once a frame from canEverTick, primaryTickGroup and the components' tickGroupOverride, which are plain fields. A mid-frame change that takes an actor OUT of a group applies at once (dispatch re-checks the fields); one that puts it INTO a group still to run this frame needs this call, or it lands next frame. Spawning, destroying and AddComponent invalidate on their own.

NotifyActorComponentAdded

C++
void NotifyActorComponentAdded(AActor* actor, MActorComponent* component)

AActor::AddComponent reports here so a component added mid-frame with a tickGroupOverride still ticks in this frame's pass, as it did when every pass walked the whole actor list.

FindActorByEntity

C++
AActor* FindActorByEntity(EntityID entity) const

Resolve the actor backing an ECS entity, or nullptr when the entity is plain ECS data (or its actor is pending kill). This is the address translation the networking layer needs: replication, relevancy and RPC routing all key off the entity carrying NetworkObjectComponent, and this is what turns one of those ids back into the gameplay object that owns it.

GetECSWorld

C++
World* GetECSWorld() const

ECS bridge Backing ECS world — systems that prefer flat iteration of typed components read from here. Set by Scene during world initialisation.

SetECSWorld

C++
void SetECSWorld(World* w)

Also tells FViewerRegistry, so a scene system holding only the ECS world can still ask where the viewers are.

GetWorldType

C++
EWorldType GetWorldType() const noexcept

World type. The Scene that owns the world keeps it current: Editor while the level is ticked in edit mode, PIE for a play copy, Game otherwise.

SetWorldType

C++
void SetWorldType(EWorldType type) noexcept

IsEditorWorld

C++
bool IsEditorWorld() const noexcept

The level as authored: actors here tick only through TickInEditor.

IsPlayWorld

C++
bool IsPlayWorld() const noexcept

A world that plays: a PIE copy or a game. Opposite of IsEditorWorld.

TickInEditor

C++
void TickInEditor(float deltaSeconds)

Edit-mode tick: gives each actor that opted in (AActor::ShouldTickInEditor) one TickInEditor(dt), round-robin from where the previous frame stopped, and stops early once ed.TickBudgetMs is spent, so a slow generator cannot stall the editor frame; the actors it skipped run first next frame. No-op unless this is an editor world: a PIE copy and a game never call it.

GetEditorTickStats

C++
const FEditorTickStats& GetEditorTickStats() const noexcept

AddPinWire

C++
void AddPinWire(EntityID srcEntity, const std::string& srcPin, EntityID dstEntity, const std::string& dstPin)

ClearPinWires

C++
void ClearPinWires()

GetPinWires

C++
const std::vector<FPinWire>& GetPinWires() const

FirePin

C++
void FirePin(EntityID srcEntity, const std::string& pin, const struct VisualScriptValue& payload)

SetBackingEntityHooks

C++
void SetBackingEntityHooks(FBackingEntityHooks hooks)

GetSubsystem

C++
template<typename T> T* GetSubsystem()

World subsystems (UE-style) Auto-instanced MWorldSubsystem singletons. One per world; Initialize(this) fires on first GetSubsystem<T>(). Lifetime = world lifetime; ~MWorld destroys all.

Generated from Game/MWorld.h via game.json · Nov 5, 2026Version 1.0.0