GUI button does not display texture

Hi,

I am making a shop menu for a part of the game. I intended to make the shop menu out of different clickable buttons for different items. Each button is an image with a shop item and price on it. If the user wants to buy an upgrade, they click the picture, and it deducts that value from their cash.

I have made the following image: Imgur: The magic of the Internet which is to be used as the first button.

The image is assigned via unity’s inspecter onto the c# script PlayerController.cs

public Texture shopMenuItem1;

void OnGUI() {
if (!shopMenuItem1) {
Debug.LogError(“Please assign a texture on the inspector”);
return;
}

The code you’ve posted only checks if something is assigned in the inspector.

You need to use GUI.Button to actually display a button

This was unfinished, sorry I accidently sent it through, here is the full thread: GUI button does not display texture - Unity Engine - Unity Discussions