How to use UI button in Update()?

How to use if Ui button OnClicked in the Update()?
For example : instead of aInput use a UI button Onclicked?

void FixedUpdate(){
		if(Input.GetKeyDown(KeyCode.Alpha1)){
			if(skills[0].currentCoollDown >= skills[0].coolDown){

				firstSkill ();
				skills [0].currentCoollDown = 0;
			}
			
	}
}

I couldn’t really understand what you want to achieve but this is the way I’m making UI Buttons work.

public void skillButton () {

       if(skills[0].currentCoollDown >= skills[0].coolDown) {
 
                 firstSkill ();
                 skills [0].currentCoollDown = 0;
       }
}

Add the your script on the GameObject you want then drag it the OnClick() function on your UI Button component. Then using the dropdown find your script then the function. Done! :slight_smile:

The important thing here is that you want to make a separate public(otherwise wont work!) function that you will call by using the button component on your UI Button.

Hope this helps!:))