Dark583
(Dark583)
February 8, 2016, 2:05pm
1
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"));
DamirH
(DamirH)
February 8, 2016, 4:50pm
2
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.
Dark583
(Dark583)
February 9, 2016, 9:34am
5
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());
}
Dark583
(Dark583)
February 9, 2016, 9:39am
6
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());
}
DamirH
(DamirH)
February 10, 2016, 12:54am
7
Note my code above, I don’t use that function. The code I posted works perfectly, been using it for a year.