For example, once you stream in a level like so :
ULevelStreamingKismet* StreamingLevel = NewObject<ULevelStreamingKismet>((UObject*)GetTransientPackage(), ULevelStreamingKismet::StaticClass());
// more stuff
StreamingLevel->bShouldBeLoaded = true;
StreamingLevel->bShouldBeVisible = true;
// more stuff
World->StreamingLevels.Add(StreamingLevel);
And then you decide to unstream it by changing the visible and loaded booleans:
StreamingLevel->bShouldBeLoaded = false;
StreamingLevel->bShouldBeVisible = false;
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.