I have custom K2Node based on K2Node_BaseAsyncTask, which is placed inside GameEditor module.
Now, this node works, when playing in editor, or when launching project from editor, but when game is packaged, it doesn’t work.
From what I can see, the proxy object is not created, and more over this node seems to consume all incoming input on execs, as anything placed on the output side of the node is not executed.
Your k2Node is probably cleaned because the editor module isn’t compiled within packaged Shipping build. I would move your k2Node to game module.
But this will create dependency on editor modules for game module.
I’ve experienced exactly this issue trying to use K2Node_BaseAsyncTask to define my own latent actions. This functionality is extremely powerful but not yet documented, so I can give you my analysis but I would love to hear an official take.
When the game is packaged, it is done so from a target compiled with (#define WITH_EDITOR 1) but without loading all of the editor dlls by default.
I believe the answer is to just manually load the editor module you need in this configuration. You can see some precedent for this in FEngineLoop::LoadStartupCoreModules(): see the load of “OnlineBlueprintSupport”, a module containing other classes that inherit from K2Node_BaseAsyncTask. You can also see FUMGModule::StartupModule() for a leaf system that has a similar conditional game->editor dependency.
This feels a bit ad-hoc so if anyone has a more official way to annotate this dependency to the UBT I’d love to hear it. I would hope to see some documentation of the targets that need to support blueprint compilation in Compiler Overview for Blueprints Visual Scripting in Unreal Engine | Unreal Engine 5.2 Documentation because I’m not confident I have all of the cases covered.
Hope this helps!
Correct, I am not suggesting distributing the editor modules.
I’m suggesting adding something like:
in his game code in order to cover this situation in which we have an editor-enabled game attempting to compile the blueprint bytecode, a process for which we need to have editor-only classes loaded.
EULA forbits distribution of editor binery code so i would watch out with letting it compile on distribution build