// Counts Metronome private void count() { beatTimer += Time.deltaTime; float interval = 30 / bpm; if (beatTimer >= interval) { if (countIn == 8 && record) { record = false; clips.setRecording(audio.clip); play = false; } if (!record) { playSequenceHit(); } if ((record || metronome) && sequence % 2 == 0) { audio.PlayOneShot(clips.metronome, 1); } beatTimer -= interval; sequence++; if (record) { countIn++; } if (sequence % (bars * 8) == 0) { sequence = 0; } } }