Functions with variable number of input pins

Is there a way to create a function node that has the “add pin” functionality on it? I want to create a function that concatenates n number of strings, and inside the function is an array that gets looped through. The array has the “add pin” function, is there a way I can expose that, rather than having a set number of inputs and therefore set array size?

yeah, give me a min.

Make function

Click on input and look in details panel

39412-capture.jpg

Then add inputs

39413-capture.jpg

From outside

39414-capture.jpg

Thank you, but this is not what I meant. There is no “Add Pin” on the outside. I would like it so the function accepts any number of arguments, and this number is defined at the instance of its use.

Make a macro to do what you want.

Look at existing macros, and make one that matches what you want.

The way to do it in Blueprint is to take an array-of-type, rather than the actual type. Then the caller can pass in an array of whatever size he/she wants. This is a work-around, not exactly what you want.

The way to do it “for real” is to write C++. Grepping for “Add pin” in the GitHub source finds a good example:

Engine/Source/Editor/GraphEditor/Private/KismetNodes/SGraphNodeSwitchStatement.cpp

which uses an API documented in a header file:

Engine/Source/Editor/GraphEditor/Public/SGraphNode.h

The interesting functions are Create{Input,Output}SideAddButton(), IsAddPiButtonVisible(), and OnAddPin().

Someone have a fully working example by now ? It would be great!

1 Like

I was searching for a similar solution and found this.

https://www.gamedev.net/tutorials/programming/engines-and-middleware/improving-ue4-blueprint-usability-with-custom-nodes-r5694/

The article shows how to fully create custom nodes from C++ and provide them for the Blueprint graphs. Very interesting article.

So far I understand the system, everything is based on UK2Node class. See UK2Node | Unreal Engine Documentation