private void OnTriggerEnter(Collider other) { // The player is the only object checkpoints can collide with, so we can safely use GetComponent here without any checks if (current) { // This needs to be recorded here because the analytics task needs the player's current health analytics.CheckpointReached(other.gameObject.GetComponent <Health>().CurrentHealth); other.gameObject.GetComponent <Health>().Heal(healthAmount); HitCheckPoint(); } }