Our project used the Water plugin to create the sea surface. But when we packaged the release version of the project, we ran it and found that the seawater was not displayed. The StreamLevel way our levels are loaded dynamically is causing this bug. Thank you, please help to solve.
This is our code for dynamically loading the level. The sea surface will not be displayed after loading the level this way.
bool UStreamingLevelObject::LoadStreamingLevel()
{
if (_streamingLevel != NULL)
{
_streamingLevel->SetShouldBeLoaded(true);
}
else
{
UWorld* PersistentWorld = ASAEEngineGameState::GetInstance()->GetWorld();
if (!PersistentWorld)
{
SAEGAME_SCREEN_ERROR_MSG(TEXT("UStreamingLevelObject::LoadStreamLevel::LoadTileToStreamingArray >> Invalid PersistentWorld!!!"));
return false;
}
UClass* StreamingClass = ULevelStreamingDynamic::StaticClass();
_streamingLevel = NewObject<ULevelStreamingDynamic>(PersistentWorld, ULevelStreamingDynamic::StaticClass(), NAME_None, RF_Transient, NULL);
FName PackageName = *_levelName; //根据项目实际情况获取并设置PackageName
_streamingLevel->SetWorldAssetByPackageName(PackageName);
//Make New Level Visible 使流关卡可见
_streamingLevel->SetShouldBeLoaded(true);
_streamingLevel->SetShouldBeVisible(true);
_streamingLevel->bShouldBlockOnLoad = false;
_streamingLevel->OnLevelLoaded.AddDynamic(this, &UStreamingLevelObject::OnLevelStreamingLoaded);
_streamingLevel->OnLevelUnloaded.AddDynamic(this, &UStreamingLevelObject::OnLevelStreamingUnloaded);
//Very Important, used by LevelStreaming* to load the map 设置流关卡的包名
_streamingLevel->PackageNameToLoad = PackageName;
//Add to UWorld 将流关卡添加到World中
PersistentWorld->AddStreamingLevel(_streamingLevel);
}
return true;
}
Hello, have you solved this problem?