Custom BP Node: What sub-class of UK2Node would I want to use?

I am exploring programming custom editor utilities, widgets, a nodes. So far, I am having a good amount of fun with it. I found myself wanting to create a custom blueprint node for a C++ function for one of my classes. It is a specialized function that I felt needed the special treatment.

I have created the custom widgets and pins I may want to add to the blueprint node, but right now I am stuck at choosing the correct class to represent the node.

The purpose of my node is to provide a more robust set of pin inputs that can’t be generated by the default UFUNCTION macro. In the end, all it does is invoke the associated C++ function (the implementation of which sets up and plays an animation montage). As a result, the first class that caught my attention is UK2Node_CallFunction.

Alternatively, since my function does a very similar thing to the engine’s existing PlayMontageblueprint node, I took a quick look to find that it uses UK2Node_BaseAsyncTask.

I do not understand why playing a montage is handled by an async task. My function will end up doing a very similar thing but I have no idea what BaseAsyncTask allows me to do. Can I get some use case scenarios for these types of nodes - why would I want to use one over the other, etc.


The async task node allows to have extra output exec pins that are fired asynchronously after the execution of the node itself, like an OnMontageEnded pin that fires when the montage ends.

BaseAsync allows the node to continue flow (the white exec wires) while the node itself didn’t finish it’s work yet;
usually useful for things you have no idea when it’s going to finish.

Most of the time I simply inherit K2Node_ tho.

In the case of the PlayMontage function, why would that be async? The way I set it up is by binding delegates when the montage ends, or a notify occurs (I believe they do the same as well). As such, when the delegate fires, the execution is not asynchronous, but I would imagine it behaves as one would expect.

Another way to ask this is, what problem is PlayMontage trying to solve by making these executions asynchronous?

Probably because the skeleton class they use as base has already everything setup to create delegates as extra “then” pins.
The base class also checks if there’s any delegates declared in the target class when used by the node so there’s a lot of hard work already done that can be reused for any similar node that execute delegates as extra exec “then” pins.
If you look in UPlayMontageCallbackProxy class you can see that the function that the K2Node_ uses is this:

static UPlayMontageCallbackProxy* CreateProxyObjectForPlayMontage(

It is marked as internalUseOnly so only K2Node_ can see it, Blueprint users cannot execute that function.

And the Proxy class also got a few Delegates declared in there.
All the declared delegates are automatically converted to exec pins by the K2Node_ class:

FOnMontagePlayDelegate OnCompleted;

//  etc...

If a proxy class is used by the K2Node_ and it constains no Delegates, Kismet compiler is going to throw an error saying that it expects delegates to call.
So probably they use that as base class for simple convenience.