void Update() { if (target != cameraFocus.GetTarget()) { target = cameraFocus.GetTarget(); targetHealth = target.GetComponent <Health> (); healthValue = targetHealth.health; targetHealthSlider.value = healthValue; } if (healthValue != targetHealth.health) { healthValue = targetHealth.health; ChangeHealth(); } }