AGameModeBase::GetGameSessionClass
#include "GameFramework/GameModeBase.h"
Access: public
Specifiers: virtualENGINE_API
Description
Returns the AGameSession subclass to spawn for this game mode. Override to supply a custom session class without changing the GameSessionClass property.
Caveats & Gotchas
- • This is a virtual override point — the default implementation just returns GameSessionClass. If you set GameSessionClass directly and also override this function, the override wins.
- • Called very early in InitGame(), before most actors exist. Avoid doing heavy logic here; just return the class.
Signature
virtual TSubclassOf<AGameSession> GetGameSessionClass() const Return Type
TSubclassOf<AGameSession> Example
Override to return a custom session class C++
TSubclassOf<AGameSession> AMyGameMode::GetGameSessionClass() const
{
return AMyGameSession::StaticClass();
} Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?