hide different planes, renderers issue

Hi,

i would like to create an animated texture, i would like to create 15 planes, add a texture to each of them, and hide them one after the other to fake the animation. This code does not work because it says “NullReferenceException: Object reference not set to an instance of an object”, i have put 2 planes with a mesh renderer (set automatically) in an empty object named “AT”, then i created a script linked to the camera, or to the AT object (in this case, i changed “at” with “this” ) :

//private var at : GameObject;
private var renderers : Renderer[];

function Start () {
	//at = GameObject.Find("AT");
	//renderers = at.GetComponentsInChildren(Renderer);
	//renderers = GetComponentsInChildren(Renderer);
	renderers = this.GetComponentsInChildren(Renderer);
}

function Update () {

    for (var r : Renderer in renderers) { /*  NullReferenceException  */
        r.enabled = !r.enabled;
    }
	
}

Would you know how to achieve this?

Thanks

If you are trying to “fake” an animation, you can create a single plane and change the texture on that plane. There is some source here:

http://answers.unity3d.com/questions/392517/introduction-movie.html

As for your code above, did you check to see if ‘renderers’ is null?