Hi everyone, I create a custom event which contains a delay node. I call it repeatedly, expecting everything in the event can do the same number times as I call it.
Like the example, I click “P” five times in 2 seconds, and you can see it in image, print “Hello” five times, it is right.
But the result is only print “world” once. I hope it can also print five times. I want to know the reason of only print once and how to do I achieve the effect which I hope?
You’re starting the execution chain again, before it’s had a chance to complete.
There is no forking of background processes here.
The easiest way to get it to do what you want, is to spawn a blueprint which prints ‘hello’, and then prints ‘world’ 2 seconds later. ( then destroys itself )
Otherwise, you’d had to keep the requests in an array, with timer handles ( or something like that ).
Maybe you can try making a integer variable that increases based on the number of times you press ‘P’ , then add your delay. Once the delay is finished use a for loop to print “World” using the integer variable then reset the variable after you finish printing.
It seems like if an event needs a long time for work, and in fact, the external will call it frequently for a short period of time (Such as my example, call it again before it complete). Then, it will have problems.
Maybe I need to rethink how to use event in my project.
Thank you for you answer!