// Use this for initialization void Start() { healthUI = GetComponent <Image>(); if (!monster_tag.Equals("Untagged")) { GameObject [] allZeGo = GameObject.FindGameObjectsWithTag(monster_tag); foreach (GameObject zeGo in allZeGo) { if (zeGo.name.Equals(monster_name)) { monsterHealth = zeGo.GetComponent <HealthScript>(); golemStateManager = monsterHealth.GetComponentInChildren <GolemBoss_Statemanager>(); golemAwakeState = golemStateManager.gameObject.GetComponentInChildren <GolemBoss_AwakeState>(); break; } } } else { monsterHealth = GameObject.Find(monster_name).GetComponent <HealthScript>(); } }