UnrealEd Dependency Causes Package Failure

Working code from 2020.

*.Build.cs:



using UnrealBuildTool;

public class TanksVr : ModuleRules
{
    public TanksVr(ReadOnlyTargetRules target) : base(target)
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
        bEnforceIWYU = true;

        PublicDependencyModuleNames.AddRange(new ]
             {
                    "Core",
                    "CoreUObject",
                    "Engine",
                    "PhysXVehicles",
                    "HeadMountedDisplay",
                    "InputCore",
                    "Networking",
                    "Sockets",
                    "Json",
                    "JsonUtilities",
                    "GameplayAbilities",
                    "GameplayTags",
                    "GameplayTasks",
                    "AIModule",
               });

          if (target.bBuildEditor)
          {
               PublicDependencyModuleNames.AddRange(new ]
                    {
                         "UnrealEd",
                    });
          }
     }
}


Somewhere in code:



#if WITH_EDITOR
#include "UnrealEd.h"
#endif

......

void ATankSpawnPointSelector::UpdateDrawing()
{
#if WITH_EDITOR
     if (GEditor != nullptr)
     {
          GEditor->RedrawLevelEditingViewports();
     }
#endif
}


5 Likes