Omichron
(Omichron)
September 10, 2015, 6:35pm
1
This is hopefully a simple question. How can I change the display value for the Return Value of a function in order to read as something other than ‘return value’ in the BP? I realize I can change the name of out params, but I haven’t been able to find how to change/set the name of the return value of a function.
I assume this is done in the UFUNCTION meta tag.
2 Likes
I would like to know this as well.
Did you get an answer for this in the end?
Answer with examples can be found here:
[How To define a function with multiple return values as blueprint in C++ - C++ - Epic Developer Community Forums ][1]
Make sure you understand: [A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums ][2]
Example:
Add the following directly before the parameter you would like to change:
UPARAM(DisplayName = "CustomNameA")
.h file:
UFUNCTION(BlueprintCallable, Category = "MyBlueprintFunctionLibrary")
static void switchValue(const float a,const float b, UPARAM(DisplayName = "CustomNameA") float &a_out, UPARAM(DisplayName = "CustomNameB") float &b_out);
Make sure to return “void” otherwise you will get the default “Return Value” pin, which as fas as I know you cannot change the display name from, then set the return parameter to the value you would like to return from the function.
.cpp file:
void UMyBlueprintFunctionLibrary::switchValue(const float a, const float b, float &a_out, float &b_out)
{
a_out = b;
b_out = a;
}
The above will output the following:
5 Likes
Pablo1517
(Pablo1517)
July 19, 2017, 11:03am
6
Hello. Can you tell me how do I achieve basically the same thing but with Actor references instead of floats?
Pablo1517
(Pablo1517)
July 19, 2017, 11:06am
7
NVM. I just found my answer. You declare the parameter like this
void Foo(AActor*& ReturnedActor);
1 Like
BBB
(BBB)
December 3, 2020, 10:52am
9
dont need to set void, the UPARAM before the function name will work:
UFUNCTION(BlueprintCallable, Category = “test”)
UPARAM(DisplayName = “newReturnName”) int func();
6 Likes
Probezeit
(Probezeit)
January 30, 2024, 8:26pm
11
Its simple:
UFUNCTION(BlueprintCallable, meta = (ReturnDisplayName = "abc"))
8 Likes
This is way nicer than adding an ugly UPARAM
in front of my function! Thank you.
2 Likes