World Partiton - Having trouble persisting actor data on deactivated cells

I’ve been digging through some of the world partition system in UE5 and I was wondering if anyone had any advice on how you would go about maintaining persistent actor data when you leave and re-enter streaming cells.

The approach I was going to take was to listen to delegates when cells were unloaded, figure out what actors within the cell I cared about, save them and restore them if the cell was loaded up again.

I’ve been having a very hard time figuring out a way to accomplish this without modifying source which I am trying to avoid doing. I was going to use UWorldPartitionRuntimeLevelStreamingCell to get access to the associated streaming level and determine the position data for the cell to gather actors but all the useful classes that would help me get this data is locked behind private functions/methods and this class doesn’t have the ENGINE_API macro so I can’t access it from my game module.

A lot of functions like UWorldPartition::GetStreamingSources() are marked as private but UWorldPartitionRuntimeHash::GetStreamingCells() is marked public but I can’t get access to the streaming sources to pass into this function to actually be able to use it. Also UWorldPartition::StreamingPolicy is marked private which seems to be the container for tracking these. I’m just trying to understand if this stuff is architecturally meant to be private and locked away or it’s just early access so the interface hasn’t been well defined yet.

The engine source for world partition as is, is pretty difficult to work with. I feel like I need to remake my own version of a lot of the infrastructure that the world partition logic establishes which I would like to avoid doing. I’m getting to the point where I might just make my own grid representation that is a literal logical copy of the one setup in the world partition system and just manually figure out the data rather than hook into the world partition system.

Any advice or insight from anyone on this kind of thing? I would imagine there has to be solutions for this problem as it is a common one for open world games

I have implemented save system for WorldPartition. It is not that hard. Actually it is almost same as WorldComposition. You do not need observe cells. Cell is represented by streaming level.
What you can do:

  1. Subscribe to LevelAddedToWorld/LevelRemovedFromWorld
  2. Get list of all levels GetWorld()->GetStreamingLevels()
  3. Subscribe to OnLevelShown/OnLevelHidden of every level

But I agree it is very hard to customize WorldPartition, too many private functions.

1 Like