No announcement yet.

Why don't timers start immediately?

  • Filter
  • Time
  • Show
Clear All
new posts

    Why don't timers start immediately?

    If I start a looping timer using Set Timer by Event or Set Timer by Function Name, the first "tick" of the timer only happens after the Time value. Why?

    The tooltip on Time reads, "How long to wait before the delegate, in seconds." However, why doesn't the first tick occur immediately and then every Time seconds after that.

    I'm trying to use a timer to spawn a bullet every 2 seconds while the mouse button is held down. The problem is that because the first tick of the timer doesn't happen until after 2 seconds, it means that it takes 2 seconds before the player sees their first bullet spawn after they hold the mouse button down. Very annoying. Is there another way to do this, or a way to force a timer to tick immediately upon start?

    Call the function you are setting the timer for right before setting the timer. This will cause it to fire immediately, and then for every 2 seconds after that. Would also want to put in some sort of do-once to block from firing that initial node over and over again, if the player were to repeatedly press and release the button, for example.