I can confirm this fixed the issue for me in 5.4.4. Thanks so much! I believe this might worthwhile for a PR; are you interested in making the PR or shall I @alexdjq. Specifically here are the changes you need:
--- a/Engine/Source/Runtime/Engine/Private/LevelUtils.cpp
+++ b/Engine/Source/Runtime/Engine/Private/LevelUtils.cpp
@@ -79,6 +79,17 @@ ULevelStreaming* FLevelUtils::FindStreamingLevel(const ULevel* Level)
return ULevelStreaming::FindStreamingLevel(Level);
}
+static bool CompareRightMostSubPath(const FString& Lhs, const FString& Rhs)
+{
+ int32 LastSlashIndex = 0;
+ if (!Lhs.FindLastChar('/', LastSlashIndex))
+ {
+ return false;
+ }
+ int32 SubPathLength = Lhs.Len() - LastSlashIndex;
+ return Lhs.Right(SubPathLength) == Rhs.Right(SubPathLength);
+}
+
ULevelStreaming* FLevelUtils::FindStreamingLevel(UWorld* InWorld, const FName PackageName)
{
ULevelStreaming* MatchingLevel = NULL;
@@ -91,6 +102,11 @@ ULevelStreaming* FLevelUtils::FindStreamingLevel(UWorld* InWorld, const FName Pa
MatchingLevel = CurStreamingLevel;
break;
}
+ if (CompareRightMostSubPath(PackageName.ToString(), CurStreamingLevel->GetWorldAssetPackageName()))
+ {
+ MatchingLevel = CurStreamingLevel;
+ break;
+ }
}
}
return MatchingLevel;
Note, 5.4.x
(fixed in 5.5.0
) also has a separate issue with connecting PIE clients to a packaged DS when using ACharacter
: Unreal 5.4 problem with a packaged game! Server spawns the character and client disconnecting with 'Failed to load package' error. - #10 by NV_gnoowik