How to make the background scale to the window size?

Hi! I am making a game, and everything almost works just fine. One problem I am still having is the window size. When I try and load the game in different window sizes, the buttons and background get all mixed up and in wrong place. Sometimes, the buttons are completely off of the screen. I need to know how to make it so no matter what window size, the buttons and background scale together.

Thank you.

Well to answer your topic title for anyone who finds this question by mistake, you would use this code to scale a background to the window size. This code makes a black background on the screen.

 function OnGUI(){
     GUI.color = Color(1,1,1, alpha );
     GUI.DrawTexture(Rect(0,0,Screen.width, Screen.height), theTexture);

To answer your question, you could try and create a canvas parent object, nest your gui items underneath, and have the canvas parent retain the same width and height and simply scale instead of scaling the gui items individually.

Hopefully that answers your question, and good luck!