Download

How can you create a "Add pin" button for inputs / outputs in c++ functions?

Hi, I’m quite new to Unreal Engine, I feel like I have started getting a decent grip of the blueprint system,
but I would like to look into how the c++ code can customize the visuals of blueprint calls etc.

How can I make any type of input parameter have a modular “array”-like feature to it with “Add pin” button?
Most of the boolean operators is a good example of how i want it to behave.

screenshot-bp-add-pin.png

Hi there Ledi!

I think what you are looking for is CommutativeAssociativeBinaryOperator = “true” inside the UFUNCTION() macro. CommutativeAssociativeBinaryOperator Indicates that a **BlueprintCallable **function should use the Commutative Associative Binary node. This node lacks pin names, but features an “Add Pin” button that creates additional input pins.

For future reference as well, you can look at the UE4 source code on github (just need to connect your github to your epic games account) to find out exactly how the nodes shown in your screenshot work in code. For instance, the logical AND of two values code looks like this:



UFUNCTION(BlueprintPure, meta=(DisplayName = "AND Boolean", CompactNodeTitle = "AND", Keywords = "& and", CommutativeAssociativeBinaryOperator = "true"), Category="Math|Boolean")
static bool BooleanAND(bool A, bool B);

Hope this helps, have a great day!