@Kevin_Gittens This is a great solution! And very close to being a great way to approach this for the original poster’s problem. A better solution would be to send the time of button press to the material, like this:
By subtracting the current time from the time of button press, it does not matter if the button was pressed at a decimal value, because the result will always start at 0, relative to the button press time. Then, you modulo the value by the animation time so it’s always repeating- in this example from 0-4, with 4 being the total number of desired seconds for the animation to finish playing. Then, we divide the number by 4 to get a 0-1 value for the animation phase.
So as an example:
The button is pressed at 11.3 seconds, this is sent to the material. The Time node is also in game time, so it returns 11.3 seconds. 11.3-11.3 = 0. Once the time node gets to 12.3, aka a full second, the value returned will be 1. 1 modulo 4 is still 1. Then, we divide this number by 4 to get 0.25. In a 4 second animation, at one second we are a quarter of a way through.
As for sending the button press time to the material, it seems like you already have that figured out, but for anyone else viewing this thread, you can do so through Dynamic Material Parameters, Custom Primitive Data, or a Material Parameter Collection- whichever suits your needs the best.
