I am trying to change the image used for a sprite in unity, I am getting the error:NullReferenceException: Object reference not set to an instance of an object This has led me to believe that my loadall function is not working since it returns an array of null objects. Here is my code:
Sprite[] sprites = Resources.LoadAll<Sprite>("Sprite/Chests");
I then use the array with this line:
SpriteRender.sprite = sprites[SpriteIndex];