示例#1
0
    private GameObject createVideoObject(int id)
    {
        GameObject plane = GameObject.CreatePrimitive(PrimitiveType.Plane);

        plane.name = "Plane #" + id.ToString();

        MeshRenderer meshRenderer  = plane.GetComponent <MeshRenderer>();
        Shader       videoShader   = Shader.Find("Color Space/YCbCrtoRGB");
        Material     videoMaterial = new Material(videoShader);

        videoMaterial.name    = "Material #" + id.ToString();
        meshRenderer.material = videoMaterial;

        GameObject         videoObject = new GameObject();
        MobileMovieTexture tex         = videoObject.AddComponent <MobileMovieTexture>();

        //tex.PlayAutomatically = false;
        tex.name = "MovieTexture #" + id.ToString();
        movieTextures.Add(tex);

        Material[] matArray = new Material[1];
        matArray[0]       = videoMaterial;
        tex.MovieMaterial = matArray;

        tex.Path = "video" + id.ToString() + ".ogv";

        return(plane);
    }
 void OnFinished(MobileMovieTexture sender)
 {
     Debug.Log(sender.Path + " has finished ");
 }
    void Awake()
    {
        m_movieTexture = GetComponent<MobileMovieTexture>();

        m_movieTexture.onFinished += OnFinished;
    }