Accessing actor in sub level
I'm creating an endless runner type game where the persistent level BP loads sub levels using the following function:
This function works as expected, but I need to be able to access a particular actor inside the level that was loaded to determine where the next level should be loaded. The Load Level Instance node returns a Level Streaming Kismet reference, but there's very little I can do with it. I've tried using an interface but the function doesn't actually run.
Is there a way I can do this?
asked Dec 12 '16 at 08:26 PM in Blueprint Scripting
Given your use case (knowing where to spawn the next sub-level instance), instead of trying to access an actor inside your sub-level, I would just have your sub-level tell a central location (like GameInstance) where the next level should be spawned:
1) Create a NextLevelLocation Transform variable in your Game Instance or Game Mode
2) On the Begin Play of all your sub-levels, get the transform of that actor you're talking about and save it into the NextLevelLocation variable.
3) When you load a new sub-level instance, just pull the location from the NextLevelLocation variable.
answered Dec 12 '16 at 08:58 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here