Resources.LoadAll returning null but everything seems right

I am attempting to use a script to create an animated fire texture. I have the textures downloaded, and they are stored in a folder “Unity Project/Assets/Resources/25 frames” which contains a number of images.

I have written the following code in my script. It is designed to load all of these images into an array of textures, and then have an update function change the texture displayed constantly (to create sensation of animation).

using UnityEngine;
using System.Collections;

public class fireTextureCycle : MonoBehaviour {

	Texture[] fireFrames;
	int framesPerSecond = 10;

	// Use this for initialization
	void Start () {
		//load fire textures
		fireFrames = Resources.LoadAll ("25 frames", typeof(Texture)) as Texture[];//("Textures/FireLoop1/PNG Frames/256x256/13 frames", typeof(Texture)) as Texture[];

		if (fireFrames == null) { 
			Debug.Log ("Load failed.");
		}
	}
	
	// Update is called once per frame
	void Update () {
		int index = (int)(Time.time * framesPerSecond) % fireFrames.Length;
		gameObject.renderer.material.mainTexture = fireFrames [index];
	}
}

As far as I can tell, this code should be correct. I have looked up the Unity documentation on LoadAll, and it seems to indicate that I have used it properly here. Despite this, I find that LoadAll always returns null. This is confirmed by my Debug.Log statement “Load Failed” which triggers every time. I have also seen some other questions on Unity Answers regarding this same issue, but the answers which I saw did not help me with my problem. Can anyone explain why I am having my issue?

Consider re-writing line 12 as either “fireFrames = Resources.LoadAll(“25 Frames”);” or “fireFrames = Resources.LoadAll(“25 Frames”, typeof(Texture));” (possibly appending “as Texture” to the latter). I believe the fault in your code might be the cast, as you might be trying to cast a texture as an array of textures, which will fail and return null. LoadAll would sooner return an empty array than a null, I think.