C++ Blueprint Callable Array passed by reference treated as return value on Blueprint Node.

I am trying to make this BlueprintCallable C++ method:

UFUNCTION(BlueprintCallable, Category = Inventory)
static void SortInventoryWidgetsByType(TArray<class UWRInventoryItemWidget *>& InventoryWidgetArray);

I am modifying the Array in C++ that was passed in from Blueprint. As you can see from the function name I am doing some Sorting on the TArray and modifying the input value.

However in Blueprint I can’t pass in the array. It doesn’t appear on the left side of the node. It’s instead on the right side and is being treated as a return value. It’s the same thing as if I made this an OUT parameter, but I need it to be an IN parameter.

I read one answer somewhere about marking the TArray as const to make it an IN parameter but that won’t work for me since I’m modifying the Array. (Heh unless I do some dirty C style typcasting to remove the const qualifier :smiley: MUAHAHAHA)

Try to use “UPARAM(ref)”.

UFUNCTION(BlueprintCallable, meta=(DisplayName="Invalidate_Guid (Guid)"), Category="Guid")
static void Invalidate_Guid( UPARAM(ref) FGuid& InGuid );

Oh that worked. Thanks. Oddly enough when I search UPARAM I find basically no documentation.

this info should be added to this page:

along with better examples of how to control input and output pins, explaining when you are allowed to use OUT parameters, explaining whether you can use Const with static functions, etc…

const references are treated as blueprint function inputs

Thanks that worked like a charm for SetKeyboardKeyColor.