Hello,
I’m trying to use the ULevelStreaming::IsStreamingStatePending function to check and see whether or not all streaming levels have finished loading or unloading. After I unload one of my levels, it continues to return true for IsStreamingStatePending, even though I think it’s done.
I checked the logic in IsStreamingStatePending, and I think there’s a bug in this line:
if (IsLevelLoaded() == ShouldBeLoaded() && IsLevelVisible() == ShouldBeVisible())
In my case, IsLevelLoaded is false, ShouldBeLoaded is false, IsLevelVisible is false, but ShouldBeVisible is true. The if statement trips, and IsStreamingStatePending returns true because IsLevelVisible doesn’t match ShouldBeVisible.
I think this is an error: in this case, it seems like the ShouldBeVisible flag wasn’t reset after unloading the level. Isn’t it moot in this case anyway? The level has already successfully been unloaded. I think the code should instead be:
if (IsLevelLoaded() == ShouldBeLoaded() && (IsLevelVisible() == ShouldBeVisible() || !ShouldBeLoaded()))
Does this look like a reasonable fix, or is there something I’m not considering? I don’t see IsStreamingStatePending used anywhere in the codebase, so I’m not sure whether or not I’m breaking anything.