How to spawn an 2D sprite with a button

I’m new to coding and using unity and I was wondering if there was any way to make a button spawn in a 2D sprite when you click on it and how would you make it a random size and color!

Instead of “spawning” the button, try making it a object that is disable until you need it, just before you enable the button change the properties of the button so that when it appears it has a random color.

About size and color, the button size property is a float you can use rand.range(numbers you want) to change the size.
And for the colors you will have to change the RGB values individually if I’m not mistaken.

There might be better solutions to this but i hope my top of my head written on a cellphone answer can give you some pointers on finding the right answer.