public void UnitClick() { Barrack barrack = GameObject.FindGameObjectsWithTag("Barrack") [barrackID - 1].GetComponent <Barrack> (); barrack.unit_count++; barrack.spawnUnit(); }