// Use this for initialization void Start() { MeshRenderer renderer = GetComponent <MeshRenderer>(); Rhythm.OnTick += (int beat) => { UnityMainThreadDispatcher.Instance().Enqueue(() => { if (Rhythm.IsNote(1)) { renderer.material.color = renderer.material.color == Color.red ? Color.blue : Color.red; } }); }; }