Wait for input without event tick? While loop causing crash?
The functionality I'm trying to include involves the player holding the reload button and then waiting for one of two inputs. With the reload button held down the player can:
I'm trying to avoid utilizing Event Tick from this solution so I implemented a while loop which sets a Boolean control flag on the loop to stop executing. However when I run to this bit of code, I get an "Infinite loop detected" in my log which causes the playback to crash. Now the infinite loop would be correct if the player doesn't provide one of those two inputs as I don't want anything to happen unless they choose one of the options listed above.
So am I programming this wrong or does Unreal not see that it can break out of the while loop eventually?
Waiting for Input by default is set to True. What can I do to remedy this?
asked Dec 21 '16 at 12:13 AM in Blueprint Scripting
Do you have to rule out using tick entirely? You could use a gate to prevent the tick actually doing anything while the reload key isn't pressed. I.e. Open the gate on pressed and close it on release.
Alternatively you could use a timeline of say, one second long with no outputs to loop over the nodes until it's released. So On Pressed plugs into Play and On Released plugs into stop. Then plug Update into your Branch.
Follow this question
Once you sign in you will be able to subscribe for any updates here