question about buttons and event onclick

i’am new in unity 3D, and i work in a project and i need do the next things with buttons and i don’t know how to do this.

i have a button empty, when i click the button change the text of the button to “X”, in the next click i change the text to “O”, in the next click change to “I” and finally in the next click return to button empty

i don’t know how to program the event and the button.

Text ButText; // edited
int counter = 0;
void Start(){
ButText = GetComponentInChildren(); // add this line
ButText.text = “”;

public void change(){
	counter += 1;
	switch (counter) {
	case 1:
		ButText.text = "X";
	case 2:
		ButText.text = "O";
	case 3:
		ButText.text = "I";
	default :
		counter = 0;
		ButText.text = "";

you have to make a reference to the ButtonText:

if you have public Text buttontext, then just drag and drop the text Gameobject on the field in the inspector.
Or u could use ButText = GetComponentInChildren(); as mentioned. The good thing about that is it finds it automaticlly provided the script is on the button.