[4.6.1, 4.7.0p8] - Set by Ref doesn't work on interface function parameter


There is a problem with setting by reference an interface function input parameter.

You can reproduce the issue;

Step 1: Create a new interface, create a new function, add a Boolean input parameter, and set Pass-by-reference true.

Step 2: Create a new actor BP, add the interface to this BP.

Step 3: Create the event you created in the interface.

Step 4: Drag the Boolean parameter, and type “set by ref”. When the Set Boolean (by Ref) node is created, set the value to True. - (So, whatever Boolean parameter we pass to this function will be set to true.)

Step 5: Compile this BP, and add an instance to the scene.

Step 6: Create an actor based BP (or select if you have any) on your scene.

Step 7: Create a new actor variable, make it public, go back to the scene, and set this variable to the BP you created in Step 2.

Step 8: Create a new Boolean variable, and make it public. Make a call to the interface function, and pass the Boolean parameter to this function.

When you execute and debug the interface, you can clearly see that the Boolean parameter is passed successfully, set to true in function scope, but somehow its value is ignored when the interface function looses execution scope and returns to the caller function.

You can try this workflow as a BP function, or within an another BP with no Interface at all, and see that it works. Somehow fails to work as an interface!

EDIT: Today, I double checked the issue with different variable types (integer, float, etc.) as interface function parameters. Same result; they do not work at all :frowning:

Kind Regards,

Hi Dynamo,

Thank you for your report. I was able to reproduce this and have entered a bug report, UE-10836 to be assessed by the development staff. As a workaround for now, use cast nodes and custom functions to create direct communication between the blueprints you need to pass by reference between instead of using a blueprint interface.

Hi Dynamo,

The problem is not directly related to interface. An event cannot return any value, neither by value, not by reference. Only function can return values.

If the function from the interface is implemented as a function (in its own graph, not on the event graph) the reference parameter is handled properly. Probably you need to add a dummy output parameter to the signature in the interface.

Sorry for troubles. A proper warning was just added.


Thanks kaziu, your answer solved my problem! ^ ^