I’d like a timer to call a function (not an event, contrary to this blueprint) in code based on a couple of parameters, at a set interval. I’m actually trying to implement this in C++ but it’s giving me a headache, so I thought I’d try Blueprint first. The following code in Blueprint is giving me an infinite loop error? I know the timer is calling itself at the start of the loop, but it’s based on an IF statement that can change, so surely this is broken? How am I supposed to correctly do the following?
The idea is that I want a function to instantly call the ‘SpawnActor’ function when the fire button is pressed, then repeat this at a given interval until we’ve spawned the correct amount of them. NOT using a delay because they’re not available to me in C++.
Hi
try this , by putting Set timer after you call fire function
OnBeginOverlap->Fire->SetTimer(with looping checked)
and you should add a boolean to check if the event is called (overlap or pressing button) to not see the timer each time this one is called cause this will reset your timer each time
It’s strange that Timers in Blueprints that are setup like this cause Infinite Loop errors, whereas ones done in C++ don’t… I think the Infinite Loop checker might be a bit too vigilant.
I did that originally and it still didn’t work, gave me the same infinite loop error, so I tried to use the Custom Event and it’s still the same issue.
I don’t think Blueprint timers allow you to call the same function or event they were fired from, whereas in code they do and it works fine (that’s how they’re used in ShooterGame).