C++ reference parameter is return value in Blueprint
I have a small problem where I have a static function in a class inherited from UBlueprintFunctionLibrary which should enable Blueprint graphs to set a variable in a structure. The function declaration looks as following: UFUNCTION(BlueprintCallable, Category = Loadout) static void SetLoadoutSlot(FLoadoutStruct & Data, uint8 SlotIndex, const FLoadoutSlotStruct & Slot);
Now the problem is that because the Loadout paramter is passed by reference, the engine thinks that it is supposed to be an out parameter so the blueprint node looks like this:
Is there a way to tell the engine not to use the parameter as an output value or do I have to return a new structure instance with this function every time I modify a value in it?
asked Jul 31 '15 at 09:00 PM in C++ Programming
I knew I'd read some way of doing this but it took me ages to finally find it again. This should really be properly documented. Anyway, here you go.
looks weird that first input param shows in blueprint as output, try add another one before it like
UFUNCTION(BlueprintCallable, Category = Loadout) static void SetLoadoutSlot(uint8 EmptyParamTest, FLoadoutStruct & Data, uint8 SlotIndex, const FLoadoutSlotStruct & Slot);
will EmptyParamTest become output pin then?
p.s. don't forget mark question as answered with little gray circle button under any answer (not comment, but whole answer) when problem solved, so anyone else later can have same question and may find solution faster, if you find solution on your own, don't forget write it too
Follow this question
Once you sign in you will be able to subscribe for any updates here