How to properly unstream and remove a ULevelStreaming from the world?
For example, once you stream in a level like so :
And then you decide to unstream it by changing the visible and loaded booleans:
But that doesn't entirely remove it from memory and the world because you still have a pointer to the ULevelStreaming and can reassign those booleans to true and the level will stream back in the world again.
So how would you remove it completely from the world? Do you make sure you delete the only pointer you have as a reference to it after you set those booleans to false? Will that completely remove it from memory?
I ask because I'm going to stream in a lot of levels in and out and I don't want to have levels dangling around that I don't need.
asked Jan 08 '16 at 01:16 PM in C++ Programming
me too ,take care of this !
answered May 07 '16 at 03:03 AM
I have yet to test this but ULevelStreaming::SetIsRequestingUnloadAndRemoval sounds like it would do the job. Currently I'm doing this by getting the loaded level with ULevelStreaming::GetLoadedLevel and then calling UEditorLevelUtils::RemoveLevelFromWorld() but this obviously won't remove unloaded streaming levels. (Which is what ULevelStreaming::SetIsRequestingUnloadAndRemoval hopefully does)
answered May 09 '19 at 09:31 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here