how can I delete a UI button?

I have a canvas set up with few images and one button. The button is used to log in. I would like to delete the button from the canvas after the user logs in, but I do not want to destroy the actual canvas, or images in the canvas. I only want to destroy the button. How can I do this?

Perhaps using this on a certain event:


You can also disable it:

yourButtonGameObject.enabled = false;

Destroying your UI seems kinda weird, and I’d recommend doing this before Destroy( … ) for most cases.