void OnTriggerEnter(Collider other) { // MyRaceAgent agent = other.gameObject.GetComponent<MyRaceAgent>(); MyRaceAgent agent = other.GetComponentInParent <MyRaceAgent>(); CheckpointManager manager = GetComponentInParent <CheckpointManager>(); manager.CheckpointTrigger(gameObject, agent); }