Hello. after package my game, im having a strange issue. /when i run Open Level persistance level to destroy everything and reload back everything, most of the times, it works fine but sometimes, the destroying process do not run but the code still continue to load everything else. Meaning, some times, after running open level, i will have 2 instant of my actor. how do i solve this issue to make sure open level destroy everything.
ps, i have tried with options in open level, ?bAbsolute=1, absolute tick in open level, disable seamless travel, destroy player controller ref before running open level.
I am not sure about persistence level. But I’ve done similar instanced level destroy and create, Unreal would try reuse the level(reusing something in the garbage collection). I have to mark the level as unload and invisible, telling Unreal to not use the level again.
An easy fix for you, make an empty level with no world settings(like L_Loading). Then in that level blueprint’s BeginPlay() open back to the persistence level.
So it’d be like: L_PersistenceLevel-> L_Loading → L_PersistenceLevel
1 Like
Thanks. i will try it. still dont understand why it only happen sometimes. some pc happen more than others
Hi @gundamwarcraft ,
This behavior may be related to performance differences between machines.
On faster PCs, the previous world is destroyed almost instantly, so everything works correctly.
However, on slower PCs, the Garbage Collection process or timers from the old world might still be running for a few milliseconds, causing actors to duplicate when the new level loads.
This could explain why the issue only happens sometimes and seems random.
You can try two things to fix it:
- Add a small delay before calling OpenLevel to give the engine time to clean up actors from the previous world.
- Use the CollectGarbage node, which forces the garbage collection process and destroys any objects that no longer have valid references.
Here’s the official documentation
and a video that explain Garbage Collection in more detail:
I also recommend considering using Level Streaming if you want more control over how your world reloads and manages resources , especially when your goal isn’t to restart the entire game, but just the playable part of the map while keeping certain global systems active.
According to the official Unreal Engine documentation:
“The Level Streaming feature makes it possible to load and unload map files into memory as well as toggle their visibility during play. This makes it possible to have worlds broken up into smaller chunks so that only the relevant parts of the world are taking up resources and being rendered at any point. If done properly, this allows for the creation of very large, seamless games that can make the player feel as if they are playing within a world that dwarfs them in size.”
In other words, Level Streaming lets you split your world into smaller sections and load or unload them dynamically, avoiding destruction or duplication issues.
This is especially useful if you want to keep your PlayerController, UI, or global Manager actors active while only reloading the parts of the level that actually need to change.
Hope it helps!