Download

UE4 - How to spawn actor at current level, when level streaming?

Hi, i use level streaming, and i need spawned pickups, to spawn at current level, not in persistant level, so they can disappear when i leave;

Right now, if i enter an area that loads another level, if a pick up is spawned using “spawnactor” and i move out from that area, everything dissapears, except that pick up wich stays at persistant level, and its kind of weird, but there is no option to choose a level to spawn, or check if that level is available then spawn in that level, so when i leave, all pickups not taken also dissapear.

Please help

I have a strange feeling I’ve already answered this one… :slight_smile:

All spawned actors appear in the persistent level, but never fear… When you spawn them, DO set the Owner parameter. That way, when you unload the stream level, because the owner gets destroyed, the system knows to also destroy the spawned actors…

I dont understand the “DO set the owner parameter” how you do that? could you show BP pics please

I also tried to do that once, but it seems like everything spawns into the persistent level and we can’t specify a streaming level / sublevel where we want to spawn an actor.
So as far as I know, there’s no way to do that, unfortunately.

That´s a flaw in Unreal Engine…

It’s by design I’m pretty sure…

Sorry this took so long, if you quote, people will know you’ve updated the thread:

spawn.JPG

I’m finding this helpful for a similar problem I’m having. It explains a lot that all actors spawn in persistent. However, if you are using world composition with a large number of levels how are you supposed to get the world location of the level to then tell the actors where to spawn?

Get stream level and get transform of the return just returns 0, , 0, 0 everytime. So if you want to say load stream level and spawn player there how do you do it?

Anything that you have in the level will have a world location after streaming, right? So if you make sure there’s a player start in each level, once it appears, you can move the player to that location.

Have you tried the solution presented here? https://answers.unrealengine.com/que…med-level.html

I was looking for a fix like this for a while. I have a menu which is set in a different level and when my spawners were spawning, the actors were spawned in the persistance. Entities that had spawned were visible in the menu where I did not want them

I got around this by adding each spawned entity to a array and then when I load into my menu level, I loop through the array on the begin play and set the actors to be hidden. I do the reverse on the end play event.

Not sure if this helps you out specifically but someone might be here looking for something similar!