Wait for input without event tick? While loop causing crash?

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.

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:

  1. release the reload button triggering event A (which I’ve got working)
  2. press the fire button triggering event B (which I’m having trouble with)

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?

Is a timeline more efficient? I’ll go ahead and accept your answer since it does in fact work, I’m just trying to think about efficiency here more than anything. A single comparison with the Event Tick isn’t a huge deal I assume but it is still happening for the entire level

Timelines more efficient in the way that it doesn’t take priority, it doesn’t need to fire every single frame. I’m by no means an expert on the matter but I’m sure if there’s something elswhere that needs the time the Timeline will just skip a tick.

Also, I think the tick is being fired every frame anyway, with or without the node. It just doesn’t do anything until you plug it into something.