RealDocs

AGameModeBase::HasMatchStarted

function Engine Blueprint Since 4.14
#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
Event BeginPlay Cast To MyGameMode Object Cast Failed As My Game Mode As My Game Mode Has Match Started Target is Game Mode Base Target Return Value Branch Condition Condition True False Get Game Mode Return Value
Edit Blueprint graph Gate actor logic until the match has started
Drag node headers to move · Drag from an output pin to an input pin to connect · Scroll to zoom · Right-click for actions
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);
}

Version History

Introduced in: 4.14

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.