Changing Texture using Timer?

Hey guys,

I’m trying to write a script where the current texture of the plane changes a short amount of given time, I know this can be achieved using a timer but it seems I cannot get it to work, the script below is used to select a random background when the game is running, can anyone help me implement a timer?

Thanks,
Beeraj

using UnityEngine;
using System.Collections;

public class BackgroundGenerator : MonoBehaviour 
{
	public Texture[] PlanetTexture;
	public float ScrollSpeed = 0.5f;
	public float Offset;

	//Use this for initialization
	void Start () 
	{

		#region Random Background Selector

		int RandomPlanetTexture = Random.Range (0, PlanetTexture.Length);
		renderer.material.mainTexture = PlanetTexture[RandomPlanetTexture];

		#endregion
	
	}
	
	//Update is called once per frame
	void Update () 
	{

		#region Background Texture Scrolling

		//Set the scrolling speed of the texture
		Offset += Time.deltaTime * ScrollSpeed;

		//Set the axis on which the background should scroll
		renderer.material.mainTextureOffset = new Vector2 (0.0f, Offset);

		#endregion
	
	}

}

I’ve fixed the problem, this is the solution:

using UnityEngine;
using System.Collections;

public class BackgroundGenerator : MonoBehaviour 
{
	public Texture[] PlanetTexture;
	public float ScrollSpeed = 0.5f;
	public float Offset;


	public float myTimer = 5.0f;
	public bool EnableChange = false;

	//Use this for initialization
	void Start () 
	{


	
	}
	
	//Update is called once per frame
	void Update () 
	{

		if(myTimer > 0 ){
			myTimer -= Time.deltaTime;
			EnableChange = true;
		}
		if(myTimer <= 0 && EnableChange == true){
			Debug.Log("Timer is Less than Zero");
			#region Random Background Selector
			
			int RandomPlanetTexture = Random.Range (0, PlanetTexture.Length);
			renderer.material.mainTexture = PlanetTexture[RandomPlanetTexture];

			EnableChange = false;
			myTimer = 5.0f;
			#endregion

		}


		#region Background Texture Scrolling

		//Set the scrolling speed of the texture
		Offset += Time.deltaTime * ScrollSpeed;

		//Set the axis on which the background should scroll
		renderer.material.mainTextureOffset = new Vector2 (0.0f, Offset);

		#endregion
	
	}

}