Expected behavior: Load all images in resources subfolder, and apply one at random to a GUITexture.
Resultng Behavior : error : Cannot cast from source type to destination type. I have the object as type route we well. I have tried Texture2D as well as Texture. On line 12 (Album =) I have also tried casting with as Texture2D.
#pragma strict
import UnityEngine;
import System.Collections;
var Album : Texture2D[];
var image : Texture2D;
var maxSize : int;
var imageFrame : GUITexture;
function Start ()
{
Album = Resources.LoadAll("LevelLoads",typeof(Texture2D));
maxSize = Album.Length - 1;
image = Album[Random.Range(0,maxSize)];
imageFrame.texture = image as Texture2D;
}