AGameModeBase::HasMatchStarted
#include "GameFramework/GameModeBase.h"
Access: public
Specifiers: virtualENGINE_APIUFUNCTIONBlueprintCallableconst
Description
Returns true once StartPlay has been called and the match-start callbacks have fired. Use this to gate logic that should only run after the world is fully initialized.
Caveats & Gotchas
- • In AGameModeBase the check is simply whether BeginPlay has been triggered on the world. In AGameMode it maps to the MatchState being InProgress or later — be careful when mixing both base classes.
- • This is a server-side query. Clients should check AGameStateBase::HasMatchStarted() instead, which reads replicated state.
Signature
UFUNCTION(BlueprintCallable, Category=Game)
virtual bool HasMatchStarted() const Return Type
bool Examples
Gate actor logic until the match has started
Blueprint
Guard a spawn attempt until the match is live C++
void AMyGameMode::TrySpawnPickup()
{
if (!HasMatchStarted())
{
return; // too early, wait for StartPlay
}
GetWorld()->SpawnActor<AMyPickup>(PickupClass, SpawnTransform);
} Tags
Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?