AnimGraph dependency leads to missing precompiled files during build step

I’ve written a custom animation blueprint node for UE 4.20, which works fine. Being an animation node, it depends on the AnimGraph and AnimGraphRunTime modules.

I’m trying to launch a project, using this node, in UE 4.21. During the launch process (when configured for either Mac or IOS, haven’t tested others), I get the error:

ERROR: System.IO.DirectoryNotFoundException: Could not find a part of the path "/Users/Shared/Epic Games/UE_4.21/Engine/Intermediate/Build/Mac/UE4/Development/ActorPickerMode/ActorPickerMode.precompiled"

To start debugging this, I’ve created a new C++ project using UE 4.21 and included “AnimGraph” PrivateDependencyModuleNames (in MyProject.Build.cs). Simply launch this empty new project leads to the same error.

Any help to resolve this error, or any advice about how to debug further, would be really appreciated!

Hello, I have the same problem. Do you find any solutions for this?

Hi, I have same problem today and solve it by packaging custom AnimGraphNode into Editor-module.
It works in UE4.21.2.

See this article:.
https://forums.unrealengine.com/development-discussion/c-gameplay-programming/116090-custom-animgraph-node-c-templates

Thanks very much seiko_dev! I confirm that this solution works on Windows with UE4.21.2.

For anyone else, check the example here. Note that you need:

  • two separate directories of source code (one for the editor and one for the game itself)
  • each source directory has its own build file (use AnimGraph as the dependency for the editor and AnimGraphRunTime for the game)
  • put only the AnimGraphNode in the editor’s source folder, and only the AnimNode in the game’s source.

My game, using the custom animation node, built correctly with the setup as described above. Thanks again!

The solution posted by seiko_dev worked for me, good luck!

Hello, thanks for seiko_dev and richardroberts’s answer.
I check the example and try to create an Editor-module to put AnimGraphNode.
Here seems need to solve some error for UE4.21.2.

Like MyGame(Editor).Target.cs no longer use public override void SetupBinaries

and MyGame(Editor).Build.cs changes public MyGame(TargetInfo Target) to public MyGame(ReadOnlyTargetRules Target) : base(Target)

There is my new Project which can compile well,
but when I package project for windows it still show same error.

UATHelper: Packaging (Windows (64-bit)): ERROR: System.IO.DirectoryNotFoundException: 找不到路徑 'C:\Program Files\Epic Games\UE_4.21\Engine\Intermediate\Build\Win64\UE4\Development\ActorPickerMode\ActorPickerMode.precompiled' 的一部分。

Is I missing something? :"(

Hi walk1120.

Try this edit in MyGame.Target.cs

public MyGameTarget(TargetInfo Target) : base(Target)
{
	Type = TargetType.Game;
	
	ExtraModuleNames.AddRange( new string[] { "MyGame" } );
}

MyGameEditor module depents on MyGame module but MyGame module must not depend on MyGameEditor module. In standalone(not PIE) running, the game is not need any NodeGraph.

Hoping that the information will be of some help to you.

Hi richardroberts. I’m happy to have been a small help.

Hi walk1120,

I believe the cause of this error (regarding the ActorPickerMode) is due to the game trying to build with the AnimGraph, instead of the AnimGraphRunTime dependency. It’s not clear from Unreal’s documentation, but the game can only be compiled using this run time version (editor nodes are not included in the game, just their implementation).

To address this issue, please check that your build files declare their dependencies like this:

For MyProjectEditor.Build.cs

using UnrealBuildTool;

public class MyProjectEditor : ModuleRules
{
    public MyProjectEditor(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
    
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });

        PrivateDependencyModuleNames.AddRange(new string[] { "AnimGraph" });
    }
}

And for For MyProject.Build.cs

using UnrealBuildTool;

public class MyProject : ModuleRules
{
    public MyProject(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
    
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });

        PrivateDependencyModuleNames.AddRange(new string[] { "AnimGraphRunTime" });
    }
}

Note that the editor only uses AnimGraph and the game itself only uses AnimGraphRunTime. Let me know if that helps!