How to Properly check which level are still loading in C++ and while till they are done to do Logic

This was my first attempt but it failed horribly … I need some advice on the most efficient way to wait till all the current levels are visible and done loading then launch a function/change a variable in the pawn class.




//UGameplayStatics::Streaming
			bool ShouldStopWhile =false;
			int32 CurrentlevelIndex = 0;
				while (ShouldStopWhile)
				{
					ULevelStreaming* CurrentLevel = UGameplayStatics::GetStreamingLevel(GetWorld(), LoadGameInstance->LevelList[CurrentlevelIndex]);

						if (CurrentLevel->HasLoadedLevel())
						{
							CurrentlevelIndex++;
							
						}
						else if(LoadGameInstance->LevelList.Num() > CurrentlevelIndex)
						{
							ShouldStopWhile = true;
						}

					UE_LOG(LogClass, Log, TEXT("HasVisibilityRequestPending?!"));
				}
				UE_LOG(LogClass, Log, TEXT("Moving on"));




I’m doing this in my game, but my code is at the office. If I don’t forget about it I’ll post it in a few hours. If I do remind me with a PM. :stuck_out_tongue:

i messaged you

And here it is:

I need to make sure the level is fully loaded and visiable but for some reason when i add this. line it gives me this stupid error

1> Creating library D:\Users\dark5\Documents\Unreal Projects\darkstorm\Intermediate/Build/Win64\UE4Editor\Development\UE4Editor-darkstorm.lib and object D:\Users\dark5\Documents\Unreal Projects\darkstorm\Intermediate/Build/Win64\UE4Editor\Development\UE4Editor-darkstorm.exp
1>Module.darkstorm.cpp.obj : error LNK2019: unresolved external symbol "public: bool __cdecl ULevelStreaming::IsLevelLoaded(void)const " (?IsLevelLoaded@ULevelStreaming@@QEBA_NXZ) referenced in function “public: void __cdecl AdarkstormCharacter::CheckLoadingStatus(void)” (?CheckLoadingStatus@AdarkstormCharacter@@QEAAXXZ)
1>D:\Users\dark5\Documents\Unreal Projects\darkstorm\Binaries\Win64\UE4Editor-darkstorm.dll : fatal error LNK1120: 1 unresolved externals




	if (LevelStream->IsLevelLoaded())
		{
			GetWorldTimerManager().ClearTimer(LoadingLevelsTimerHandle);
			UE_LOG(LogClass, Log, TEXT("Level %s loaded!"), *LoadGameInstance->LevelList[CurrentlevelIndex].ToString());
			TurnonPlayerGravity();
		}
		else
		{
			UE_LOG(LogClass, Log, TEXT("Level %s loaded but not visable yet!"), *LoadGameInstance->LevelList[CurrentlevelIndex].ToString());
		}



I need to make sure the level is fully loaded and visiable but for some reason when i add this. line it gives me this stupid error

1> Creating library D:\Users\dark5\Documents\Unreal Projects\darkstorm\Intermediate/Build/Win64\UE4Editor\Development\UE4Editor-darkstorm.lib and object D:\Users\dark5\Documents\Unreal Projects\darkstorm\Intermediate/Build/Win64\UE4Editor\Development\UE4Editor-darkstorm.exp
1>Module.darkstorm.cpp.obj : error LNK2019: unresolved external symbol "public: bool __cdecl ULevelStreaming::IsLevelLoaded(void)const " (?IsLevelLoaded@ULevelStreaming@@QEBA_NXZ) referenced in function “public: void __cdecl AdarkstormCharacter::CheckLoadingStatus(void)” (?CheckLoadingStatus@AdarkstormCharacter@@QEAAXXZ)
1>D:\Users\dark5\Documents\Unreal Projects\darkstorm\Binaries\Win64\UE4Editor-darkstorm.dll : fatal error LNK1120: 1 unresolved externals




	if (LevelStream->IsLevelLoaded())
		{
			GetWorldTimerManager().ClearTimer(LoadingLevelsTimerHandle);
			UE_LOG(LogClass, Log, TEXT("Level %s loaded!"), *LoadGameInstance->LevelList[CurrentlevelIndex].ToString());
			TurnonPlayerGravity();
		}
		else
		{
			UE_LOG(LogClass, Log, TEXT("Level %s loaded but not visable yet!"), *LoadGameInstance->LevelList[CurrentlevelIndex].ToString());
		}



Note my code above, I don’t use that function. The code I posted works perfectly, been using it for a year.