Converting UnityEngine.Object to UnityEngine.Texture2D, missing cast?

Hello!

I am trying to create an array from a stack of images I have in a folder called "flash" in the Resources directory, then accessing those images from the array and applying them to a plane in my scene.

When I compile it tells me I can't do an implicit conversion. I'm a beginner at C#, and I cannot use Javascript for this task. Any help would be greatly appreciated.

Here is my code:

void Start () {

    //create a new object array and load it with everything in Resources/flash
    Object[] aImages = Resources.LoadAll("flash");

    //debug report size of array and all objects inside it
    Debug.Log("The size of the array is: " + aImages.Length);
    int i = 0;
    while (i < aImages.Length){
        Debug.Log("The item at position" + i + " is: " + aImages*);*
 *i++;*
 *}*
 *//take the first object from the image array and put it in variable texImage*
 *Texture2D texImage = aImages[0];*
 *//put texImage onto plane*
 *renderer.material.mainTexture = texImage;*
*}*
*```*

You need to explicitly cast the Object to a Texture2D

Texture2D texImage = (Texture2D) aImages[0];

I have similar problem…
I am calling all children gameobjects and telling their renderers to set their texture from a folder of .png’s… I get no errors but the texture’s are not showing up… Any help? Thank you!!!

using UnityEngine;
using System.Collections;
using UnityEditor;

public class enMassTexturing : MonoBehaviour {

	private GameObject[] m_gameObjects;
	private Object[] m_files;
	
	void textureQuads(){
		m_files = AssetDatabase.LoadAllAssetsAtPath("Assets/Resources/P3G2/Textures/.png");
		m_gameObjects = GetComponentsInChildren<GameObject>();

		for(int i = 0; i < transform.childCount; i++)
		{
			Texture2D m_texture = (Texture2D)m_files*;

			m_gameObjects*.GetComponent<Renderer>().material.mainTexture = m_texture;

		}
	}
}