i am defining an array of sprites, i drag and drop each sprite in the editor and they show up, but once i click play all the sprite slots change to empty( i.e. [NONE]). I don’t get this, each sprite i drag n drop into the array is there and shows up…but once i click play they are all gone…why is this happening? Here is a shortened pc of code that doesn’t work:
using UnityEngine;
public class GameManager : MonoBehaviour {
private Vector3[] picLocations;
public Sprite[] spriteArr;
private int numberOfPics = 3;
void Awake()
{
picLocations = new Vector3[numberOfPics];
spriteArr = new Sprite[numberofPics];
// I have drag'n'dropped these sprites in the editor and they show up (until i click play, then they disappear).
Debug.Log(spriteArr[0].name);
// this line gives null reference error, no matter if it's in awake, start, update, a random function, etc.
}
Thanks in advance for any help, I am totally stumped on this one,
James