Remove "Return Value" on functions returning a struct

When a functions returns a reference to a struct, it displays the return variable as “Return Value.” Is it possible to change this to perhaps the type of the struct for example. When you split the return value node, it then also appends “Return Value” to the front of every member of the struct, which makes it very cluttered to read. Can this be removed so it just shows the names of the members of the struct on their own. It will be so much cleaner and easier to read.

See the screen shot below that illustrates both issues. With the first node, it would be great if it could say “MyStruct” instead of “Return Value.” With the second node, the member variables should display as just “Name” and “Material” without the “Return Value” appended to the front of them.

screenshot.png

You can use the UPARAM(DisplayName = “NameToBeDisplayed”) Macro infront of your parameters to specify a custom name

That doesn’t work in this case as the return value is not a parameter.


UFUNCTION(BlueprintPure)
static const FMyStruct& GetMyStruct(const int32 Index);

I could modify the function like this. This doesn’t require the UPARAM macro as it will already display “MyStruct” instead of “Return Value” on the output pin.


UFUNCTION(BlueprintPure)
static void GetMyStruct(const int32 Index, FMyStruct& MyStruct);

However, this only half solves the problem. When you split the output pin on the node, you then end up with “MyStruct Name” and “MyStruct Material,” which although is better, is not ideal. This solution also has the problem of changing the C++ interface as well as the return value has been moved from the function return type to a parameter. So it would either require all consuming C++ to change, or a second function would need to be created, one for blueprint consumption and one for C++ consumption.

UPARAM also seems to work when placed before function’s return type, something like this:


UFUNCTION(BlueprintCallable, Category = "XMath")
static UPARAM(DisplayName = "Current Out") FTransform& TrotInterpTo(UPARAM(ref) FTransform& current, const FTransform& target, float deltaTime, float interpSpeed);

Is this something that might have changed? I’ve got this:

UPARAM(DisplayName = "bIsSuccess") bool TrySpendResources(const int Amount);

and the pin still shows up as “Return Value”:

image

1 Like