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?
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
Hello, my problem here is that a parameter passed by reference will be exposed as an output value in blueprint. For functions like
void GetTransforms(FVector & OutLocation, FRotator & OutRotation)
this makes sense, but in my case I want to modify a structure instance and therefore need a non const reference! It would be great if you had to specify which parameters are output values in the UFUNCTION macro or only use parameters as output which start with “Out”.
Edit: And yes I tested it with an additional uint8 parameter as the first one, which will be a usual input in blueprint and the reference is still an output.
Thanks a lot kamrann! Exactly what I was looking for! I think they should add this to the UFunction documentation page so it is easyer for people to find it.