UnrealModFramework
Mod framework API
Loading...
Searching...
No Matches
UModInstance Class Reference

A game-thread Mod entry point owned by one game instance. More...

#include <ModInstance.h>

Inheritance diagram for UModInstance:
UModInstanceSubSystem UModTestPackageInstance UModTestParticipant

Public Member Functions

MODLOADER_API UWorld * GetWorld () const override
 Returns the extension World or the World of the owning game instance.
MODLOADER_API FString GetModId () const
 Returns this instance's active package ID on the game thread.
MODLOADER_API bool AcquireWorldAPI (FName TypeId, const TCHAR *Signature, uint64 &OutContext, uint64 &OutObject)
 Acquires a host-approved world provider on the game thread.
MODLOADER_API bool AcquireModService (FName ServiceId, FName TypeId, const TCHAR *Signature, uint64 &OutContext, uint64 &OutObject)
 Acquires a declared cross-Mod service on the game thread.
MODLOADER_API void ExecuteOnModLoadCompleted (const FModLoadNotification &Result)
 Dispatches load completion to Blueprint or the C++ override.
MODLOADER_API void ExecuteOnModBeforeUnload ()
 Dispatches unload notification to Blueprint or the C++ override.
MODLOADER_API void ExecuteOnModRegister ()
 Dispatches the mod register callback to Blueprint or the native override.
MODLOADER_API void ExecuteOnModBind ()
 Dispatches the mod bind callback to Blueprint or the native override.

Static Public Member Functions

static MODLOADER_API void * ResolveHostAPI (const char *Module, const char *Symbol)
 Resolves a host API table query on the game thread.

Protected Member Functions

virtual void OnModLoadCompleted (const FModLoadNotification &Result)
 Receives the result of a load operation on the game thread.
MODLOADER_API void ReceiveModLoadCompleted (const FModLoadNotification &Result)
 Blueprint event for a completed Mod load.
virtual void OnModBeforeUnload ()
 Releases game state and references before this Mod is unloaded.
MODLOADER_API void ReceiveModBeforeUnload ()
 Blueprint event dispatched before this Mod's content is unloaded.
MODLOADER_API void ReceiveModRegister ()
 Registers this mod's extensions while its World is preparing.
virtual void OnModRegister ()
 Registers compiled C++ extensions before the World is ready.
MODLOADER_API void ReceiveModBind ()
 Acquires declared services after all providers register.
virtual void OnModBind ()
 Binds compiled C++ consumers after all providers are registered.

Detailed Description

A game-thread Mod entry point owned by one game instance.

Member Function Documentation

◆ AcquireModService()

MODLOADER_API bool UModInstance::AcquireModService ( FName ServiceId,
FName TypeId,
const TCHAR * Signature,
uint64 & OutContext,
uint64 & OutObject )

Acquires a declared cross-Mod service on the game thread.

Parameters
ServiceIdA service required by the owning package.
TypeIdThe generated service interface.
SignatureThe caller's generated table signature.
OutContextReceives a context owned by this Mod instance.
OutObjectReceives the revocable service token.
Returns
True when the service is available and authorized.

◆ AcquireWorldAPI()

MODLOADER_API bool UModInstance::AcquireWorldAPI ( FName TypeId,
const TCHAR * Signature,
uint64 & OutContext,
uint64 & OutObject )

Acquires a host-approved world provider on the game thread.

Parameters
TypeIdStable identity of the requested provider.
SignatureThe caller's generated calling table signature.
OutContextReceives the session-owned context token.
OutObjectReceives the non-owning provider token.
Returns
True when the host authorized and issued both tokens.

◆ GetModId()

MODLOADER_API FString UModInstance::GetModId ( ) const

Returns this instance's active package ID on the game thread.

Returns
The package ID, or an empty string outside the active lifetime.

◆ OnModBeforeUnload()

virtual void UModInstance::OnModBeforeUnload ( )
inlineprotectedvirtual

Releases game state and references before this Mod is unloaded.

Runs once per instance on the game thread while the Mod's content is still mounted. Call Super::OnModBeforeUnload to dispatch the event.

Reimplemented in UModTestPackageInstance.

◆ OnModLoadCompleted()

virtual void UModInstance::OnModLoadCompleted ( const FModLoadNotification & Result)
inlineprotectedvirtual

Receives the result of a load operation on the game thread.

Parameters
ResultThe completed startup or manual load result.

Call Super::OnModLoadCompleted to dispatch the Blueprint event.

◆ ReceiveModLoadCompleted()

MODLOADER_API void UModInstance::ReceiveModLoadCompleted ( const FModLoadNotification & Result)
protected

Blueprint event for a completed Mod load.

Parameters
ResultThe same load result passed to the C++ entry point.

◆ ResolveHostAPI()

MODLOADER_API void * UModInstance::ResolveHostAPI ( const char * Module,
const char * Symbol )
static

Resolves a host API table query on the game thread.

Parameters
ModuleOwning module in the generated SDK contract.
SymbolQuery symbol in that module.
Returns
A borrowed symbol address, or null when unavailable.

The documentation for this class was generated from the following file: