I am trying to load images in my resource folder so that I can cycle through them during run time to animate 2D characters. I am getting an error when I try to Add the textures into the array. I’m new to this List…normally I use arrays. Anyone see the mistake?
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class ImageAnimation : MonoBehaviour
{
public string fileName;
public bool loop;
private float pictureRateInSeconds = 0.04166666666666666666f;
private List<Texture2D> imagePictures;
private int imageCounter;
void Start()
{
imagePictures = new List<Texture2D>();
}
void InitializeImage(string fileName)
{
Object[] imageTextures;
imageTextures = Resources.LoadAll( "TestImages", typeof(Texture2D));
for(var i = 0; i < imageTextures.Length; i++)
{
imagePictures.Add(imageTextures *);*
-
}* -
}*