It appears certain Virtual functions within Unreal base code, which should be override-able (at least in oop principles; Virtual is a concept to achieve Polymorphism) using Blueprints, are not available to be overridden. For example, I am learning A TON about Multiplayer. To implement Multiplayer, (as well as just a good design practice) it’s imperative that one fully understands the Gameplay Framework (ie GameInstance, GameMode, GameState, PlayerController, Hud, etc).
I was looking for a good place to initialize things BEFORE BeginPlay() was called on all actors in a level. Eureka, Unreal Documentation to the rescue!!!
It turns out AGameModeBase.StartPlay() transitions calls to BeginPlay on All Actors in the level. Cool; I want to initialize the Gameplay Framework Class set here! Sounds like a great place, right?
For example, a multiplayer racing game would have a track selected on a server, and a number of laps chosen by the server. I’m guessing to store something like LapCount in an override of GameInstance (since GameInstance is about the only thing that doesn’t get destroyed from Level to Level) is preferred. Then after level transition (ie menu/lobby to level) get a handle to GameInstance from the GameMode and set the GameState and PlayerState with information like RaceLapCount, etc.
That’s great, however, I would like to initialize the GameState, PlayerState(s), etc inside GameMode.StartPlay() by implementing my own functionality, THEN calling the base class method to continue its routine. I’m thinking this would be great because before even a single actor ticks in the level, everything is set up cleanly. Ok, Cool…
HOWEVER, In Blueprints, no class derived from GameModeBase can have this VIRTUAL function, nor some other virtual functions overridden. Why? Is there a way to override this?
If I simply cannot do this in Blueprints, where is a safe place to initialize all elements of Gameplay Framework Classes BEFORE BeginPlay() is called on any actor?