Loading a image to display on screen


I want to have the game load a map, when the user finds it, displayed in the top right hand corner.

I’ve tried a few things, but i’m not able to find something that works, the map is image.jpg stored in the resources folder

public var myTexture : Texture = Resources.Load(“image”);

throws up

“Load can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don’t use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.”

you can’t use a function call in your declaration of a variable… you would have to say:

 public var myTexture : Texture;

 function Start(){
 myTexture = Resources.Load("image");


you need to put this call BEFORE the

  GUI.color = Color.black; 


if(map) //you don't actually need the "== true" part
GUI.DrawTexture(Rect(100,100,100,100),myTexture);   //or the brackets if it's only one line

 GUI.color = Color.black;

don’t know why that happens though