why cannot build movie texture on android?

hi all, i want to play video in unity, and i found that using movie texture, and i can use it on standalone, but when i want to build on android device, i get some error just like here :

  • The type or namespace name `MovieTexture’ could not be found. Are you missing a using directive or an assembly reference?

  • Error building Player because scripts had compiler errors

this is my code:

using UnityEngine;
using System.Collections;


public class Movie : MonoBehaviour {
	public MovieTexture movie;
	private float movieTimer;
	void OnGUI(){
		GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), movie);
		if(movie.duration < movieTimer){
			print("Movie Finish");
	// Use this for initialization
	void Start () {
	// Update is called once per frame
	void Update () {
		movieTimer += Time.deltaTime;

anything wrong? or i have miss something so i can’t build movie texture on android?

please help me…


I realize this is a bit old, but it still came up in my search results when trying to solve a similar problem.

There are two parts to this solution…

First, any code using “MovieTexture” MUST be set only for PC builds. The game I am working on is for Android and PC, so I use the following preprocessor commands:

    MovieTexture stuff;

The second part is that you cannot have any movies applied as textures in your scenes. Even if you are not using them, they cannot be set as a texture.

Because it’s not supported on iOS or Android as you can read in the docs

It’s an annoyance that any code including MovieTexture won’t compile for Android etc. This means that you need to preprocess your code, including any public fields to exclude the code from the compiler. This seems fine since MovieTexture fields will get serialized as development happens in the Editor, but if there were classes that didn’t exist on the desktop, but needed to get serialized for Android etc. then this wouldn’t work. Smells bad to me.

Check this :