gui button custom skin not applying background

void OnGUI()
if (Input.GetKey(KeyCode.UpArrow))
{ = guiSkin;

				float xpos = transform.position.x;
				float ypos = transform.position.y;
				Rect position = new Rect( xpos, 150 + ypos , 53 * 2, 87);
			GUI.backgroundColor = Color.clear;
			GUI.Button(new Rect(xpos, 150 + ypos, 53, 87), "", "button1");
				//GUI.Button(new Rect(620 + xpos, 150 + ypos, 53, 87), guiSkin.focused.background);


I have a custom gui skin that is hooked up through the inspector with an element named button1 that I am trying to display with the line

GUI.Button(new Rect(xpos, 150 + ypos, 53, 87), “”, “button1”);

but nothing shows up. However if I put “hi” or something as the text the hi shows up so it is being called button1 is just not showing up, I am receiving to errors or warnings so it “sees” button1 but it’s just not showing.

edit: I have played around with colors on the text and I can confirm it’s calling the button1 style but it’s not displaying the background image, any help?

For the custom style to show properly without having a reference stored in a variable you need to change the button declaration to include a look up for the style. SO this line:

GUI.Button(new Rect(xpos, 150 + ypos, 53, 87), "", "button1");

Should look like this:

GUI.Button(new Rect(xpos, 150 + ypos, 53, 87), "", guiskin.FindStyle("button1"));

Turns out this line was the culprit:

GUI.backgroundColor = Color.clear;

I was turning the background image clear.