// Update is called once per frame void FixedUpdate() { float curTime = Time.time; HeartBeatEntry entry = new HeartBeatEntry(); entry.time = curTime; entry.beatSize = sourceHeartBeat.GetBeatAtTime(curTime); entry.entryId = sourceHeartBeat.GetCurrentBeatId(); entries.Enqueue(entry); while (entries.Peek().time < curTime - queueTimeSeconds) { entries.Dequeue(); } }