UPARAM(ref)
UPARAM(ref) is a macro used in Unreal Engine with C++. It is typically used to pass parameters by reference in Unreal Engine function declarations. Let's go through each step:
UPARAM: This is a macro provided by Unreal Engine. It is used to annotate function parameters and modify how they are treated by the engine.
(ref): The
(ref)
part of the macro indicates that the parameter should be passed by reference. When a parameter is passed by reference, any changes made to the parameter within the function will be reflected in the original variable that was passed in.
By using UPARAM(ref)
, you are instructing Unreal Engine to treat the parameter as a reference parameter, allowing you to modify the original value of the parameter from within the function. This can be useful when you want to modify the value of a variable passed into a function and have those changes persist outside of the function scope.