// Use this for initialization void Start() { totemObject = transform.parent.gameObject.transform.parent.gameObject; totem = totemObject.GetComponent <Totem> (); maxHealth = totem.getMaxHealth(); currentHealth = totem.getCurrentHealth(); currentHealthBar = transform.GetChild(0).gameObject; }
// Update is called once per frame void Update() { this.currentHealth = totem.getCurrentHealth(); UpdateHealthBar(); }