๐ Gorgeous Game State
Short Description
GameState subclass that keeps AutoReplication data and broadcasts player-state events.
Long Description
AGorgeousGameState provides an AutoReplication mixin for match-wide data and exposes events when player states are added or removed. It is replicated to all clients, making it ideal for shared runtime state.
๐ Features
- AutoReplication mixin with runtime entry registration.
- PlayerState added/removed events for Blueprint logic.
- Default Object Variable trunk for shared state.
๐ Usage Examples
AGorgeousGameState* GS = GetWorld()->GetGameState<AGorgeousGameState>();
GS->RegisterAutoReplicationEntry(TEXT("MatchState"), UString_SOV::StaticClass(), true, false, {});
Use On Player State Added to initialize per-player data on all machines.
RegisterAutoReplicationEntry
Registers or updates an AutoReplication entry at runtime.
| Parameter Name | Type | Description |
|---|---|---|
Key |
FName |
Entry key used for lookup. |
DefaultClass |
TSubclassOf<UGorgeousObjectVariable> |
Class for the default variable. |
bReplicate |
bool |
Whether to replicate the entry. |
bOverrideStreamConfig |
bool |
Whether to override stream config. |
StreamConfigOverride |
FGorgeousAutoReplicationStreamConfig |
Optional stream config override. |
GS->RegisterAutoReplicationEntry(TEXT("MatchState"), UString_SOV::StaticClass(), true, false, {});
Best Practices
- Use GameState for shared data that all clients should see.
Troubleshooting
- If player events do not fire, verify the class is used as the active GameState.