I was able to resolve this by checking if the build was an editor build before including ‘UnrealEd’ dependency and wrapping the code that depends on it with #if WITH_EDITOR
if (UEBuildConfiguration.bBuildEditor)//we only want this to be included for editor builds but not packaged builds
{
PublicDependencyModuleNames.AddRange(
new string] {
"UnrealEd",
}
);
}
#if WITH_EDITOR
#include "LevelUtils.h"
#include "LevelEditor.h"
#endif
...
bool ADoWPlayerController::IsGameMultiplePIE()
{
bool IsGamePie = (GetWorld()->WorldType == EWorldType::PIE);
bool IsDedicated = false;
int32 NumberOfClients = 0;
#if WITH_EDITOR
ULevelEditorPlaySettings* PlayInSettings = Cast<ULevelEditorPlaySettings>(ULevelEditorPlaySettings::StaticClass()->GetDefaultObject());
PlayInSettings->GetPlayNetDedicated(IsDedicated);
PlayInSettings->GetPlayNumberOfClients(NumberOfClients);
#endif
return IsGamePie && (NumberOfClients > 1 || IsDedicated);
}
Thank you Michael for the help!