How can i show the texture in the array?

I have this script and i am wondering how i can display the texture that is in this array. The script i have is:

var personArray : Array = [myPerson];
var myTexture : Texture;


class myPerson
{
	var name = "Brandon";
	var texture : Texture;
}

function Start ()
{
	texture = myTexture;
}

function OnGUI () 
{
	GUI.Button(Rect(0, 0, 100, 100), personArray[0]);
}

Declare array of textures.

var personArray : Texture[];

From scene you can give array length and just drag and drop your textures to the elements of array (public parameters).

Then you call that texture as

function OnGUI () 
{
    GUI.Button(Rect(0, 0, 100, 100), personArray[0]);
}

HTH…

well the above answer solves the problem of handling texture with arrays, but it is not a good practice to link textures to scripts from editor, since they will stay in memmory as long as the gameObject is in the scene… For an instance 20 of 4mb texture will hold 80 mb in RAM for nothing.

Better practice is to use string arrays of path to texture and use Resources.Load() function to load them when needed. It will be automatically unloaded by garbage collector or you can use this function to do that manually.

This suggestion becomes completely useless if you have to use all of the textures at once. But just remember that objects(not only texture) that are attached to editor will stay in memory until the gameobject exists.