I just noticed in the comments that you’re wanting to do this on Android. You should really try to include such details in your question as it effects the answer!
As far as I can tell, this is not a supported feature on Android. There are workarounds though.
Your problem is that you’re trying to access the renderer’s material as if it is a static variable (belongs to the class), when it is an instance variable (belongs to the instance).
What you want to do is use GetComponent() to get the Renderer you’re after (there will certainly be many Renderers in your scene, which is why you have to get the instance rather than the whole class). It wouldn’t make sense for the material properties to be static features of the Renderer class!
sujit11dec is along to right tracks, and his solution will work in older versions of Unity. However, in Unity 5 they removed some “shortcuts” to accessing components (which deceptively look like variables).
Here:
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(AudioSource))]
public class video : MonoBehaviour {
public MovieTexture movie;
// Use this for initialization
void Start ()
{
GetComponent<Renderer>().material.mainTexture = movie as MovieTexture;
movie.Play();
}
}
It might be worth reading up on classes and static variables/functions. It’s reasonably simple (and key/core!) stuff, but you might find it helpful to get a better grasp of some of the core concepts for future work.