Hey guys, first time poster and Blueprint noob here.
I’ve been trying to unload specific Sub-Level instances which I spawned, I’ve tried numerous things, but can’t seem to get it to work properly. I figure it got something to do with my references? But since I’m as much a beginner as I can be, I’m not able to recognize what I’m doing wrong.
What I Want
I’ve got a sidescroller level with two segments, both levels (set as sublevels of a persistant map). An initial script in the persistant level spawns Segment_1, after that I managed to spawn Segment_2, (once the player walks through a triggerbox). The issue comes up when I enter a triggerbox in Segment_2. It should delete the lastest instance of Segment_1 , and spawn a new instance of that segment after itself - in short, creating a level that loops infinitely, almost like an endless runner.
My Problem
The spawning works perfectly, and I can keep running forever. But the game doesn’t unload the previous instances of that level.
Check the screenshots below. When I spawn an instance, I set its name in a variable in another actor (called " BP_segman" - for segment manager-). Before spawning a new instance, I ask a reference of the old one and aks to unload it. But it doesn’t work. If I enter the level name manually in the Unload node, it unloads only the initial instance. So I’m pretty sure my issue is with passing and saving the correct reference.
Can any of you help me / spot my error?
Thanks a million for any help!
Note: I don’t know anything about C++
Segment Blueprint
Segment Manager Blueprint