How to disable a button after click in c#?

I’ve some buttons that i need to disable them after clicking using C# script.

public void BtnOnClick() { gameObject.GetComponent<Button>().interactable = false; }

set BtnOnClick as your onclick method for the button

public Button button1;

public void DisableButtonOnClick()
button1.interactable = false;

//Drag the button1 in the main camera or where the script is present