public void OnSliderValueChange(Slider slider) { int value = (int) slider.value; this.counter.text = value.ToString(); if (this.globalManager == null) { this.globalManager = this.globalManagerObject.GetComponent<GlobalManager>(); } if (this.globalManager != null) { this.globalManager.playerMaxUnitCount = value; } }