Set timer 'time' float isn't changing

I’ve set a timer on a function to change a material at regular intervals - when the player interacts with the object the rate of change should increase or decrease so I’ve connected a variable to the ‘time’ pin. I can see that the variable is changing but it doesn’t actually affect the rate of change. If it starts at 2 seconds I can see that the connection from the custom event to the first set material always loops every 2 seconds - even though the variable switches between 2 and 1.

What am I doing wrong here?

I didn’t understand what behavior are you expecting, maybe you can explain a little more ?

I’ve done the same that you have on that picture so when i start, my object switches materials every 2 seconds, then when i press “f” my object switches materials every 1 second, is that what you are trying to do? because it works for me the way you have on that picture, maybe it is an 4.18 issue, have you tried on 4.17??

Ah yes, it actually does work the way I have it in the picture - but only because of the delays! If you set it up without them, you can see that the changing variable connected to the timer doesn’t actually change the timer speed. The timer float value only changes if I exit and reenter the trigger box. So I guess the timer needs to be reset in some way?

Oh i see, it is because the function is taking only the first input you give since you start calling it on the exact frame the character overlap the collision box and only in this moment, never again, blueprint functions works calling c++ functions, so in this case, it is not that this timer will execute over and over again, it calls its c++ equivalent, the timer manager to start a timer with only the first input provided

a workaround is invalidate the timer then starting it again with the new value every time you press f

Ok, thanks very much Daher, that looks like it should work :slight_smile: I have another work around that seems to do it but it’s a bit messy - connecting the timer to the F key input so it will execute each time. I’m actually using synths that need to be synchronized, I was using the material change to try to get it working. The synths need to be synced exactly so I’ll try both ways and see which is better - I think they might actually do the same thing?

As far as i know every time you set the timer again you need to invalidate it, otherwise it will run all of them at the same time but yes, i think they do the same