I am finding something weird as I clean up event graphs by taking inputaction events (aka an action mapping) that execute x number of nodes and turning those nodes into a function.
When I use an action mapping for something bound to say F3 (using it to switch camera components on a pawn) when I have a multigate set to loop == true, start index -1 and is random == false then Out0 changes to one camera, Out1 switches to next, and it repeats.
This works fine in event graph.
When I take gate and nodes after it and put them into a function however, It will only execute Out0.
I even tried Out0 and Out1 to be simple print strings, It will only execute Out0 no matter how many times I press f3 ( input action event) and I tried just using a regular key event too.
How to replicate:
-Create an action mapping in project settings to key of your choice
-Put InputAction âyour_name_hereâ node into event graph
-Create a function and have input action (or even just a simple key event) call it on âpresssedâ
-In function have it execute a gate (Like I said im using is random = false, loop = true, start index = -1, but settings dont matter) and have out0 PrintString > âhello worldâ and have out 1 PrintString > âHello world againâ,
Thanks for screenshots! I was able to reproduce this issue in 4.7.4 as well as our main internal build, and Iâve entered a bug report for it (UE13209). Iâll let you know as soon as I see an update on it. Thanks!
So this is unfortunately (somewhat) by design. It can be frustrating and confusing in some scenarios (like yours), but in others, it can be equally as confusing. current behavior lets you utilize a multigate in a function without worry of having to reset it (what if youâre using it in a for loop?).
broad reason is this: functions do not keep state. It is a high level principal that we wish to stay consistent with. If you used a local variable inside function, would you expect it to have value that it was set to last time that function was called, or would you want it to reset to its initial default value (hopefully later)? You can think of multigates like this; internally they have a local variable that tracks nodeâs state, and functions start from a clean internal state every time you call them.
Our bigger concern here is discrepancy when collapsing a multigate into a function (behavior is changed). Weâre internally debating how to best communicate this to user. If you have any ideas, weâd love to hear them.
Thanks for bringing this to our attention (in testing this, it did expose a nasty multigate crash bug).
I just stumbled upon same Problem.
PLEASE add a at least a single line of documentation stating that " multigate may not work as intended when used in functions" ( or better copy or link to explanation above ) to multigate documentation over here.
This is basically a 5 Minute Fix that will make it easier for future users. I understand why technical issue is a âwonât fixâ. however, missing documentation on this design decision is definitely not fixed.
All the local variables inside a Function get reset once a function fires again externally, this includes Multigate, Do once, etc, basically a function is ânewâ every time it runs, you can use a multigate node connected to loops within the function, but once the logic leaves the function everything is reset