Why "set by-ref var" doesn't work when getting the reference from inside a function?

I’m using the “Set by-ref var” node to set the value of a variable, and selecting which variable I’m setting from a boolean select node:

Since I’m using that selection many times in my graph, I decided to turn it into a pure function:


but now, for some reason it doesn’t work anymore, it won’t set the value for the selected variable.

any ideas why?

You can try removing the select and making it a branch instead, then return the variables accordingly (which won’t be by ref). I believe your current implementation is losing scope once it returns.

1 Like

for whatever reason functions cant return a ref, at least in blueprint, you can use a macro though

It has to be by ref, since I’m choosing which variable to set, and not the value.

Regardless, doing it via branch doesn’t work with by-ref either

Welp, macro works indeed. Thanks!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.