// Use this for initialization void Start() { character = GameObject.Find ("Character").GetComponent<CharacterController> (); healthTransform = GameObject.Find ("Health (1)").GetComponent<RectTransform> (); cachedY = healthTransform.position.y; maxXValue = healthTransform.position.x; minXValue = healthTransform.position.x - healthTransform.rect.width; maxHealth = character.MaxHealth (); curHealth = maxHealth; }