Closed cyphusx closed 1 year ago
Thanks for this!
Q about the OnLevelHidden
calls though: all this is going to do is store the level state in the active state in memory, once the system has fully shut down that state is just going to be discarded, so it's not really worth doing? Unless something could jump in at the very last minute and save it, but that's unlikely if we're already in Deinitialize
. I think unsubbing from hidden/shown is all that should be done here rather than the save.
Ah, that is a good point, I'll sort out an updated version tomorrow - cheers!
Updated to no longer call OnLevelHidden during Deinitialize, and updated some spaces to be tabs.
Awesome, thanks very much! All merged.
When the player quits to desktop from a world partitioned world, the levels start to receive the
OnLevelHidden
callback.Midway through processing all of the levels,
USpudSubsystem::Deinitialize()
gets called, and then all GameInstance subsystems, includingUSpudSubsystem
, are removed from the GameInstance.However, the world continues to process the
OnLevelHidden
callbacks, but they are now not able to retrieve theUSpudSubsystem
in order to save the level state, and this causes a crash.I've resolved this a number of ways - first, the
OnLevelHidden
andOnLevelShown
methods now check for a validUSpudSubsystem
, and throw an ensure with an explanation if it's not valid.Secondly, when
USpudSubsystem::Deinitialize()
is called, I'm clearing out the list of monitored streaming levels, and manually callingOnLevelHidden
on those that are still visible, so that their state is stored before the subsystem is destroyed.