using UnityEngine;
using System.Collections;
public class PlayMovie : MonoBehaviour {
// Use this for initialization
public MovieTexture movTexture;
private bool playonce = false;
void Start() {
renderer.material.mainTexture = movTexture;
//movTexture.Play();
}
// Update is called once per frame
void Update ()
{
}
void OnMouseDown()
{
playonce = !playonce;
if(playonce == false)
{
movTexture.Stop();
}
}
void OnGUI()
{
if(playonce)
{
print("Play video");
GUI.DrawTexture(new Rect(0,0,Screen.width,Screen.height),movTexture,ScaleMode.ScaleToFit);
movTexture.Play();
}
}
}