hi
i’m having a little trouble in my unity game and i’m hoping to have a little help here.
i have some clickables GO in my scene, i need to show a panel with a Slider as children whenever a GO is clicked, the slider when showed should increase it’s value progressivly until it’s filled.
My problem is that the Slider increases it’s value one time (not until its filled) as i clicked over the GO one time, what i want is that the Slider should increase it’s value until it’s filled everytime i clicks over a GO
i’m using this code but it’s not working
void OnMouseDown(){
GameObject.Find ("CanvasAliments").GetComponent<CanvasGroup> ().alpha = 1;
Slider niveau = GameObject.Find ("CanvasAliments").transform.FindChild ("Panel").transform.FindChild ("Slider").GetComponent<Slider> ();
niveau.value += Time.deltaTime;
if (niveau.value == 1) {
Debug.Log ("done");
}
}