Why does my loop not work at all in unity? If the tempo is too high (120), it freaks out, but I need the tempo that high for a rhythm game.
void Update()
{
BeatTime += Time.deltaTime;
if(BeatTime > (60 / Tempo))
{
Beat();
BeatTime -= (60 / Tempo);
}
}
What it is supposed to do is play the function Beat every beat according to the tempo. I've tried changing the way I added and removed the value on BeatTime, and changed the if condition, but it doesn't work. I want to get a consistent beat but it doesn't work. Unity C#.