void colliderCheck(RaycastHit hit, int offset) { if (hit.collider.tag.Equals("SingleNoteCyan")) { GameObject hitSingleNote = hit.transform.gameObject; try { NoteControl noteControl = hitSingleNote.GetComponent(typeof(NoteControl)) as NoteControl; noteControl.Hit(); } catch (Exception ex) { Debug.Log(ex.Message); } } }