How do you pass by ref a variable to a function in C++

this is the BP version:

image

if I do like this:

void ChangeNumber( float &number ) 

that variable will work as an output in the node but I want to pass the variable as reference and change inside the function (the diamond conector)

ummm the & actually works but it puts the variable as an output anyway

image

any way to hide the output results? like the BP version?

image

image

first is C++ second is BP function

	UFUNCTION(BlueprintCallable , DisplayName = "Change the number")
    static void ChangeNumberC(float &number)
	{
		number = 1234;
	}

Try to use modifier UPARAM(ref) before parameter type:

void ChangeNumber( UPARAM(ref) float &number );
6 Likes

Genius.

Thanks!! :slight_smile: