Hi everyone,
I am new in coding and unity in general. I am working on a simulation, scripted in c#, and I want that the player is able to click on an object and get more information about that object in a popup. The popup must consist of a PNG(homemade (name: clickonme)) and a cross in a small box(generated by Unity) to exit the popup. In this picture (see attachments if this is too small to read)
you can see the errors that Unity indicates (MonoDevelop says that there are no errors), I have obviously done something wrong and I think that the thing that goes wrong is me not knowing how to tell Unity which file(the PNG) to use. (I really don’t know how to formulate this better sorry)
So if someone knows how to correct this that would be great!
Thanks for replying and you can always ask me if I forgot some information!
This is my code:
using UnityEngine;
using System.Collections;
public class onclickGUI : MonoBehaviour {
// Use this for initialization
private bool PopUp;
public string Info;
public GUITexture clickonme;
void OnMouseDown()
{
PopUp = true;
}
void DrawInfo()
{
if(!clickonme)
{
Debug.LogError (clickonme);
return;
}
GUI.DrawTexture(Rect(50,50,250,250), clickonme, ScaleMode.ScaleToFit, true, 10.0f);
Rect close = new Rect (250,50,50,50);
if (PopUp)
{
GUI.Box(Rect, Info);
if (GUI.Button (close,"X"))
{
PopUp = false;
}
}
}
void OnGUI()
{
DrawInfo();
}
}