I have many image in folder screenshots. So this script will be calling the image from folder without applying. But the thing is, the image only displays one image. I mean they did not go to next image like slide show or fade in/out.
Then I keep getting this error message:
IndexOutOfRangeException: Index was outside the bounds of the array.
It points to this code:
ImageHolder[i].GetComponent<RawImage>().texture = thisTexture;
Full code:
Texture2D thisTexture;
byte[] bytes;
string fileName;
public GameObject[] ImageHolder = new GameObject[1];
    
void Start()
    {
        var imagesToLoad = Directory.GetFiles(Application.dataPath + "/screenshots", "*.png");
        for (int i = 0; i < imagesToLoad.Length; i++)
    
        {
            thisTexture = new Texture2D(100, 100); //NOW INSIDE THE FOR LOOP
            fileName = imagesToLoad[i];
            bytes = File.ReadAllBytes(fileName);
    
            thisTexture.LoadImage(bytes);
            thisTexture.name = fileName;
    
    
            // This line
            ImageHolder[i].GetComponent<RawImage>().texture = thisTexture;
        }
    }
}
Here I attached the output. I have 4 RawImage's. The image just displays and gets stuck.

 
    