Unreal – Assertion failed after UGCExample project packaging

which performed

Assertion failed: !FPaths::IsRelative(Dir) [File:/Engine/Source/Runtime/Projects/Private/ProjectDescriptor.cpp] [Line: 337] 
../../../UGCExample/../RemappedPlugins/ is not an absolute path

Solution

Modify line 143 of ProjectDescriptor.cpp:

// If this is a packaged build and there are additional directories, they need to be remapped to the packaged location
if (FPlatformProperties::RequiresCookedData() && AdditionalPluginDirectoriesValue->Num() > 0)
{
    AdditionalPluginDirectories.Empty();
    FString RemappedDir = FPaths::ProjectDir() + TEXT("../RemappedPlugins/");

    // Fixed assertion failed
    RemappedDir = FPaths::ConvertRelativePathToFull(RemappedDir);

    AddPluginDirectory(RemappedDir);
}

analysis

The AddPluginDirectory function only accepts absolute paths, but FPaths::ProjectDir() sometimes returns a relative path, causing RemappedDir to be synthesized into a relative path, which is detected by AddPluginDirectory's check and causes a crash.
This can be solved by using the function FPaths::ConvertRelativePathToFull to force the RemappedDir to an absolute path.

UE4 is a mature business engine

4 thoughts on "Unreal – Assertion failed after UGCExample project packaging"

      1. Hello, I encountered the same problem. I tried your method to modify the ProjectDescriptor file of the engine, then restarted and re-exported it, but it didn't seem to take effect and the problem persists. Is it possible that the engine needs to be recompiled? If so how to compile? Anyway, how did you solve this problem? Thanks

Post Reply