Unexpected node Type error when compiling K2Node made only by "Then" & "Execute" pins

A number of things:

  1. You should probably be overriding IsNodeSafeToIgnore to return true. The alternative (when nodes aren’t ignored) is a much more complicated implementation.
  2. You should also be overriding ExpandNode to call BreakAllNodeLinks. Ultimately this function will be what replaces your node with the other nodes that aren’t ignored.
  3. The second parameter to CreatePin shouldn’t be created manually. You should be using the constants from the UEdGraphSchema_K2 scope.
  4. There is no PinCategory of type “then”. The output pin should also use the UEdGraphSchema_K2::PC_Exec category just as the input pin does.
  5. While you can specify the name of the pin as the third parameter (and most of the time you have to), you should use the ones provided by the schema (UEdGraphSchema_K2::PN_Execute & UEdGraphSchema_K2::PN_Then) for the primary execution pins (if/when your node requires them). There’s built in logic to the blueprint graph that is designed to work with those specific names and if you don’t use them, your node won’t always work in the graph the same as similar nodes.
  6. Unless you have a very specific reason, calling Super:: should come first and not last (as you do in AllocateDefaultPins). The exceptions here are where the function is part of a shutdown process like EndPlay in which case the Super:: call should come last, but this is really relevant to K2Nodes.