CountDown Textures

Hello everyone.

I know that this code is wrong. could someone help me with it?
Its my 1st script (by heart) im writing and i got stuck. I just cant think of how i can
make 10 image change until 0 and then load the game. (I can see the number i added in
Texture due to the ExecuteInEditMode but not when i press start)

Does someone knows how i can change this?

@script ExecuteInEditMode;

// the textfield to update the time to
public var textfield: Texture;
// time variables
public var allowedTime:int = 10;
private var currentTime = allowedTime;
private var r_textfield : Rect = new Rect (10, 10, 40,80);

function Start () {
CountDown();

}

function Update () {
if (currentTime <= 0)
{
Application.LoadLevel(“Level”);
}
}

function Awake(){
// retrieve the Material Number Component and set the texture
textfield = GetComponent(Texture);

}

function CountDown(){
while( true ){
currentTime = currentTime - 1;
yield WaitForSeconds(1);
}

}

function OnGUI(){
GUI.DrawTexture (r_textfield, textfield);
}

well to change the image based on the time variable you can use an array

just get all the textures into the array from the Inspector then put this code into it

if you need any more help or this doesn’t work, don’t hesitate to PM me on the forums. Good Luck!

I still get the option of uploading just one image. Never used Arrays before. I ve sent you a PM.
When all this is done i ll post it here so if anyone else is trying to figure it out they would be able to find it here :slight_smile:

Thanks for the reply