Hey guys,
I’ve got 40 images in my resources map. and the following code.
//HUDAnimation
private Texture2D HUDtop;
private bool animate;
private Texture2D[] hudAnimationArray = new Texture2D[40];
private int arrayPosition;
private string temp;
public void AssignTextures() {
for(int i = 0; i < hudAnimationArray.Length; i++) {
if(i < 10) {
temp = "0000" + i.ToString();
}
else if(i >= 10) {
temp = "000" + i.ToString();
}
hudAnimationArray[i] = Resources.Load("Hudcrop_" + temp, typeof(Texture2D));
}
}
For some reason I’m getting this error
I’ve been stuck at this for a while and cannot find what the problem is.
The error comes from the line with "hudAnimationArray = Resources.Load(“Hudcrop_” + temp, typeof(Texture2D));"
Would appreciate some help.