I'm currently working on a countdown or count up in my case, but I'm having trouble doing certain actions on the right time, mostly because my script is flawed. My script is not right on point, I made it so when it's between to floats and action will happen, and that fluctuates between some timing with an action and a sound.
public float timeValue;
private void FixedUpdate()
{
timeValue += Time.deltaTime;
if(timeValue > 25.2 && timeValue < 25.4)
{
//Random Animation
}
if(timeValue > 26.2 && timeValue < 26.4)
{
//Sound Effect connected to Random Animation
}
}
As you can see, it varies from time to time when timeValue hits between those floats, because it doesn't hit the same float everytime. I want a solution to do it right on point.