Dear Friends at Epic,
Since we cannot include anything from the Editor Source,
How can we ship games that have custom animation nodes that we use in the editor in our Animation Blueprints?
I have to include Animgraph and BlueprintGraph in my private dependencies in order to get my custom animation nodes to work!
Specifically for the animgraph node
//Whole point of this is to be wrapper for node struct
// so it depends on it, and that node must compile first
// for type to be recognized
class UAnimGraphNode_VictoryTurnInPlace : public UAnimGraphNode_Base
But these headers depend on UnrealEd, so when I go to ship my project it cannot compile UnrealEd.
So how do I build and use custom animation nodes?
You’re allowed to extend and modify the editor however you want to in order to create your game, including adding your own custom anim graph nodes. But as you indicated, you are not allowed to ship anything that depends on our editor code. Luckily, there is no need to!
You should create a new game module inside your game project that will contain only editor-specific code. For example, if your primary game module is called “MyGame”, you would create another module alongside it called “MyGameEditor”. This module will contain all of your editor-specific stuff for your game, such as your custom anim graph node.
Then, edit your “MyGameEditor.Target.cs” file, and make sure that your “MyGameEditor” module is listed in the “ExtraModuleNames” in the SetupBinaries() function. This means that when compiling your game as an editor DLL, your game’s special editor module will be compiled too.
Because your “MyGame.Target.cs” file does not list “MyGameEditor” as a dependency, your editor features will be omitted when compiling your actual shipping game.
This is the pattern that we use for all of our games here at Epic.
I also forgot to mention, after adding your “MyGameEditor” module, you should also edit your “MyGame.uproject” file and add an entry for your editor-specific module to that file, so that the engine knows about it and will load it at startup.
Thank you very much Mike (Hi Mike!) for your detailed and very helpful answer!