So you’re using this cool new World Partition thing to make an open world game.
Then you need to dynamically spawn actors, like building a base, or procedurally generate some monsters.
Surprise! They don’t live in your World Partition levels, and do not unload when you leave the cell range.
After scouring countless threads and talking to various folks, and withholding myself from diving into C++, here a Blueprints only hacky I’ve come up which works (as of 5.3), so you don’t have to.
The idea is to have an empty actor live inside every world partition cell at level-edit time. These will properly load/unload with World Partition cells. Then, upon spawning actors, we set the owner of the spawned actor to be this empty actor. The loading and unloading of this “helper” actor will cause your spawned actors to load and unload as well!
We start by creating a blank actor and adding a box collider. We’ll use the box for overlap checking, so make sure to set this box collision to overlap only.
Then we must place one of these in each grid cell of the world partition. You can see the size and visualize it in the world details panel.
Now, any time you spawn an actor, find the overlapping helper actor
… and set it as its owner. That’s it!
For your own sanity, you could make an editor widget blueprint that creates one helper per grid (just by doing some grid math).
And there you go, one helper per cell.
Ofcourse… it would be really nice if this functionality was done automatically at the engine level, say… a checkbox that enforces the Is Spatially Loaded boolean.
Seems like an oversight on Unreal’s part which makes World Partitions harder to use than need be. Alright, good luck!