Why my Image.sprite keeps saying null ?? Help!
Hi, I'm a newbie in Unity. I try to make a quiz game. There's few files scripts that I made. I want to show an image in some of my question, but it keeps saying an error (NullReferenceException:Object reference not set to an instance of an object QuestionList.setImage (System.String filepath))
The problem is in one of my scripts.
 public void setImage(string filepath)
         {
             img.sprite = Resources.Load<Sprite>("Sprites/"+filepath) as Sprite;
         }
 public Image getImage()
     {
         return img;
     }
Here's the other scripts to set and use the image
 que[27].setImage("image33");
 
 img = que[27].getImage();
I already have an Image in my scene and set img with the Image in my scene, but it won't change. I already have the image in folder Sprites and the folder Sprites in folder Resouces
I already try using this.
 public void setImage(string filepath)
     {
         image = Resources.Load<Sprite>("Sprites/" + filepath);
     }
 
 public Sprite getSpriteImage()
     {
         return image;
     }
and the other script
 que[27].setImage("image33");
 
 image.sprite = que[27].getSpriteImage();
It's not getting an error, but it's not work.
I'm confused. Can anyone help me with this promblem? I'm using unity 5.3.5f1. Sorry if I've bad english. I hope you understand what I mean. Thank you.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                