Function is being called multiple times.

I understand that my function is being called several times because I have two action nodes attached to it (branch and SpawnActor) but I cannot figure out a way to return multiple values from a function without forcing a call twice.

Is this possible?

The following should only call the function once but is actually calling it three times. The BRANCH node is creating one call and the SPAWNACTOR is creating two calls.

Which function is called multiple times? SpawnActor or the output wire of SpawnActor?

Try using the DoOnce node or DoN.

Sorry my mistake for not clarifying. ReturnOpenPlatform is called once by the BRANCH node and twice by the SPAWNACTOR.

But, there are absolutely no loops of any sort involved.

It has to call twice for the branch and the spawn, since the branch needs the value of TileFound, and the spawn needs platform location, yeah. I don’t know if there’s much way around that other than splitting the function into two. Since even if you store PlatformLocation, it would still call it an additional time to do that. I’m not sure why it is called twice for the spawn though, what happens before the branch node?

I wonder if you returned a struct with both variables, you could set it, break it, and then get the values separately without calling the function again. But that might not be ideal