SeniorDebuggingOccasionalNot answered yet
A value set on the GameMode never reaches clients — how do you trace the authority flow?
The server sets CurrentRound on the GameMode and clients read it to update their HUD, but every client reads 0. Marking the property Replicated and registering it in GetLifetimeReplicatedProps changed nothing.
UCLASS()
class AArenaGameMode : public AGameModeBase
{
GENERATED_BODY()
public:
UPROPERTY(Replicated)
int32 CurrentRound = 0;
void StartNextRound() { ++CurrentRound; } // called on the server
};
// On a client, to update the HUD:
int32 UArenaHUD::ReadRound()
{
AArenaGameMode* GM = GetWorld()->GetAuthGameMode<AArenaGameMode>();
return GM ? GM->CurrentRound : 0; // always 0 on a client
}
Find and fix the bug.
AGameModeBase exists only on the server, so any property set on it is invisible to clients by design — it never replicates. The fix is to move shared data to AGameStateBase, which replicates to everyone, marking the property Replicated with an entry in GetLifetimeReplicatedProps. Trace it by confirming the value is written on the authority and that clients read it via GetGameState(), not GetGameMode().
- ✗Putting client-visible state on the GameMode instead of the replicated GameState
- ✗Assuming the GameMode replicates a copy to clients if its property is marked
Replicated - ✗Forgetting to register the GameState property in
GetLifetimeReplicatedProps
- →How would you push a one-off event from the GameMode to all clients without a persistent property?
- →Why does
GetGameMode()return null on a client, and what should you call instead?