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() {
GUI.Label(new Rect (10,10,150,20), "Score: "+score);
if (!shopMenuItem1) {
Debug.LogError(“Please assign a texture on the inspector”);
return;
}
if (shopMenu.Equals (true)) {
if (GUI.Button (new Rect (50, 50, 50, 50), shopMenuItem1))
Debug.Log (“Clicked the button with an image”);
}
!shopMenuItem1 displays the error in the logs when I run the game, implying that no texture is assigned, even though it is assigned in the inspector: http://puu.sh/df0hT/3f0596992f.png
I have tried assigning a gui texture instead, but it gives this error instead, which I don’t understand :
http://puu.sh/df0Bp/537ef6203d.png
I appreciate any help you might be able to offer.
Cheers
Lucio