private void UpdateKaitaiMaterialsInfo(ShipModel setShip) { if (setShip == null) { for (int i = 0; i < 4; i++) { _materialObj[i].SetActive(false); } return; } int[] array = new int[4]; for (int j = 0; j < 4; j++) { array[j] = 0; } MaterialInfo resourcesForDestroy = setShip.GetResourcesForDestroy(); array[0] = resourcesForDestroy.Fuel; array[1] = resourcesForDestroy.Ammo; array[2] = resourcesForDestroy.Steel; array[3] = resourcesForDestroy.Baux; for (int k = 0; k < 4; k++) { if (array[k] > 0) { _materialObj[k].SetActive(true); UILabel component = ((Component)_materialObj[k].transform.FindChild("LabelMaterial")).GetComponent <UILabel>(); component.textInt = array[k]; } else { _materialObj[k].SetActive(false); } } }