// Use this for initialization void Start() { GameObject slider = GameObject.Find("KickPowerSlider"); if (slider != null) { kickPowerSlider = slider.GetComponent <Slider>(); } kickPowerSlider.value = m_pBallRef.getKickPower(); }