IsLevelLoaded, IsLevelVisible and BeginPlay

My project loads and unloads levels on the fly. These levels bring in a custom camera with them and some gameplay can’t progress until we know the camera is in place and BeginPlay is called on the camera actor.

IsLevelLoaded seems to trigger before the camera is activated. IsLevelVisible triggers afterward and is exposed on iphone but not on PC.

Solution: copy the contents of IsLevelVisible inline in my own CPP. I’m not the first person to hit this problem, I won’t be the last.

Question1: Is that the correct way to check that all components of a loaded scene are ready to play?

Question2: Why not expose IsLevelVisible on all platforms?

Request: Expose IsLevelVisible on all platforms and put a nice comment on it, or tell me that I need to do things a different way.

My general takeaway on streaming at the moment is that it’s nicely functional but the API could do with some love, at minimum in the comments region but possibly in terms of function names also!

Thanks all!

Hi,

ULevelStreaming::IsLevelVisible and ULevelStreaming::IsLevelLoaded are accessible on all platforms, not sure why you don’t see it on PC. IsLevelVisible means that all actors/components for sub-level was registered in the world and ready to play.

Nice theory.

CompilerResultsLog: Info    Creating library C:\Users\\Documents\Unreal Projects\MM_04\Intermediate/Build/Win64\UE4Editor\DebugGame\UE4Editor-MM_04-3484-Win64-DebugGame.lib and object C:\Users\\Documents\Unreal Projects\MM_04\Intermediate/Build/Win64\UE4Editor\DebugGame\UE4Editor-MM_04-3484-Win64-DebugGame.exp
CompilerResultsLog:Error: Error Module.MM_04.cpp.obj : error LNK2019: unresolved external symbol "public: bool __cdecl ULevelStreaming::IsLevelVisible(void)const " (?IsLevelVisible@ULevelStreaming@@QEBA_NXZ) referenced in function "public: bool __cdecl FLevelLink::IsLoading(void)const " (?IsLoading@FLevelLink@@QEBA_NXZ)
CompilerResultsLog:Error: Error C:\Users\\Documents\Unreal Projects\MM_04\Binaries\Win64\UE4Editor-MM_04-3484-Win64-DebugGame.dll : fatal error LNK1120: 1 unresolved externals
CompilerResultsLog: Info -------- End Detailed Actions Stats -----------------------------------------------------------

I’ll be honest, I have no idea why its not exported (on one platform, but not another) but when I looked it up I’m not the first to have have problems with it.

See this thread

was this ever resolved? im having the same issue…

Sounds like it wasn’t then!

If you look at the function def its very simple and you should be able to implement it yourself.

Odd though.

This is mine:

ULevelStreaming *pStreaming = UGameplayStatics::GetStreamingLevel(mp_World.Get(), FName(*LevelName));
if (pStreaming)
{
		return pStreaming->GetLoadedLevel() && pStreaming->GetLoadedLevel()->bIsVisible;//IsLevelVisible(); IsLevelVisible is not available on all platforms.
}