Configure UTickableWorldSubsystem

This subsystem lives along with the world and is initialized and destroyed at the same time. It’s a subclass of UWorldSubsystem, but with a Tick function.

This class is particularly useful for creating a “Game Master” system to manage game events, like spawning enemy waves or handling level transitions.

To use UTickableWorldSubsystem, you need to override the virtual function TStatId GetStatId() const override and call Super::Initialize(Collection) if you override the Initialize function. This will set UTickableWorldSubsystem::bInitialized to true.

If your UTickableWorldSubsystem doesn’t call the Tick function, make sure to call a Super:: function, and check that IsTickable() returns true (which is the default if you haven’t overridden the function).

In my game, I use a UTickableWorldSubsystem in the “arcade” scene to manage the different waves of platoons sent to defeat the player.

// Header
class THEPATHTOL0_API UL0PlatoonGameMaster : public UTickableWorldSubsystem

	virtual void Initialize(FSubsystemCollectionBase& Collection) override;
	virtual void Tick(float DeltaTime) override;

	virtual TStatId GetStatId() const override
		// Used for profiling means (
		// Some use `return GetStatID()` (mind the upper case on ID) which create a TStatId. I prefer declare my own:

// Body

void UL0PlatoonGameMaster::Initialize(FSubsystemCollectionBase& Collection)
	// Don't forger to call Super::, do the rest of the init here

void UL0PlatoonGameMaster::Tick(float DeltaTime)


Leave a Reply

Your email address will not be published. Required fields are marked *