Hi,
When playing in a world with world partition enabled, it seems that when world partition cells are streamed out, they are kept alive for a while so that if they need to be streamed in again, they are taken as is and the actors in it only have “BeginPlay” called on them (this seems to be done as an optimization). The issue that we have is that actors in these cells are not reset to what they should be when calling “BeginPlay” after recycling them (compared to when they were first loaded in their first “BeginPlay”) and they might contain data that was modified from their previous life. This might not cause issues for some actors, but for actors which rely on logic performed in their “BeginPlay” on the values that are not reset, this becomes problematic. This could generate many issues if people don’t fully reset their content. Is this a bug or really the intent of Unreal engine?
Thank you!
Hello,
Indeed, actors can be “resurrected” as mentioned in the actor lifecycle doc. It’s highly recommended that actors are implemented in a way that assumes they may be reused. Although there are settings such as s.ForceGCAfterLevelStreamedOut and LevelStreaming.ShouldReuseUnloadedButStillAroundLevels that can be changed, it’s far better to be able to change these settings as needed for performance and optimization reasons than as a workaround for how certain actors are implemented.
World Partition specifically disables ForceGCAfterLevelStreamedOut to instead only force a GC based on how many levels are pending purge (wp.Runtime.LevelStreamingContinuouslyIncrementalGCWhileLevelsPendingPurgeForWP) in UWorldPartitionSubsystem::OnWorldPartitionInitialized.
Thanks,
Ryan
Thank you Ryan for the confirmation. Perhaps it would have been nice to be able to exclude some actors from this logic or to be able to automatically reset some without having to rely on artists to do so on their side manually (on a large production, this could be error prone).
Thank you!
We have received some feedback around the implications of reusing the levels causes. However, I don’t think there are any plans to change the behavior currently.
-Ryan