how to disable a button for a while

i want to disable a button for a while when we does’t enter a player name. please help me guys,i want to disable the button for a while when we does’t not enter ther name

did not check it but this is how it should be done I think.

public GameObject buttonToDisable;
void Update(){
if(name.Text == '") button.SetActive(false);

else button.SetActive(true);

}

should i write on the same scripts?
@MineKnight10398