Our custom game instance class holds lots of references to things and is potentially slowing the initial load time of the game, is it possible to change the gameInstance class during runtime? Potentially before loading a new scene that makes use of it.
Thanks
It’s impossible, creation of game instance is hard coded in to engine init code.
Generally keeping reference should take any noticable performance, pointer are technically integer variables so any operation on them takes as same as integer operations which with current CPUs is not noticeable, or else you create objects on init, then it then take as memoery allocation is know to take time. Even so i don’t belive it will take much noticeable loading time.
Either way if oyu really want to you need to think out of the box in this kind of situation
Initiating extra empty pointers does don’t make much diffrence, so either try binding world create and destroy events to make you code react to code changes and make those refrences, just keep in mind in editor each preview window creates new world and trigger those events so you need to filter them out, UWorld class let you check if it’s preview world or PIE
Or create other UObject class just for those references and create it when you needed and keep refrence to it in game instance