Can Level Instances have exposed variables?

That’s a tough one. I’ve done an insane amount of testing on loading levels including Level Instances and nothing is simple or easy. In theory, once BeginPlay is called, you should be good to go, but each actor is called in random order. I also don’t know how to get a Level Instance from an actor without iterating over everything.

Note that Level Instances aren’t loaded and displayed right away in a production build. Embedded Level Instances are a weird beast. In the editor, they’re not even in a LevelInstance. They’re in the main level itself because they’re preloaded. But in a production build, they’re in the Level Instance.

There is a LevelInstanceSubsystem. From that, you can get all the Level Instances. And you can even call LIS->ForEachActorInLevelInstance(LevelInstanceActor, lambda) to iterate over each actor in a level instance. Make sure to skip over WorldSettings actors.

When you say you have an actor in a Level Instance and you tried to access a “parent”, what parent are we talking about here? The Level Instance? Or is it attached to another actor?

The biggest problem you’re gonna have is knowing when a LevelInstance is loaded. If you use a Dynamic Level Instance, this is actually easier because you can manually load it and attach a delegate to the OnLevelShown event. But for embedded LevelInstances, there is no such possibility and it’s REALLY difficult to know when it’s done loading.

I have a writeup here if you want to know more about how levels load.


My advice would be to use a dynamic streaming level instance. IOW, load the level instance manually. Then you can attach a delegate to the OnLevelShown event. Then you can use your own function or BP event to do the setup you want. You have the Level Instance because you loaded it manually. So you can use the LevelInstanceSubsystem to iterate over the actors in the level instance and find the actor with your setup BP if you want to do it that way (or just have everything in the original BP or function).

1 Like