I’m trying to spawn actors inside a certain streaming level, and I need to make them “children” of that level, so that when it unloads, the actors go with it.
How do I do that in blueprints?
The documentation shows there’s an OverrideLevel option for the SpawnActor function, but it’s not exposed in blueprints for some divine reason. I don’t want to use C++.
In the fold out details of the spawn node, you get to set the owner. As long as the owner is set to something that is actually from the level, when the level unloads, the actor will get destroyed.
Otherwise, by default, everything is spawned in the persistent.
But wait, what if I have multiple streaming levels loaded at the same time? I’ll have multiple of those “spawner” actors. How do I know to which level each belongs?
How about creating a Game Instance BP, and storing each spawner’s reference there? You can hardcode a string variable with a specific name pertaining to that level, since the game instance reference can be called anywhere, you’ll have a reference to whichever spawner you want at your virtual fingertips
So you mean creating a string var in the spawner actor, and dropping that actor in each of my levels? But how would I reference those actor instances in the game instance?