ユニティ学習 - ビデオ再生の問題

バグの再現:

動映像テクスチャーのビデオドラッグを再生すると、パッケージ後にこの動画が削除された場合でも、プログラムはまだビデオを再生することができます。

movieTexture.Play();直接放送映像。偉大な神がグループを導くためにした後、スクリプトに対応するオブジェクトをドラッグすると団結、彼らは関係のリソースを関連付け、そのプロジェクトに直接パックするときことがわかりました。

WWWは、動的にビデオコードを再生ロード:

using UnityEngine;
using System.Collections;
 
public class MovePlay : MonoBehaviour {
 
    public MovieTexture movieTexture;
        public WWW www;
    string datapath;
 
	// Use this for initialization 
	void Start () { 
        datapath = Application.streamingAssetsPath+ "/DLXX.ogv";
        Debug.Log("file://" + datapath  );
        StartCoroutine(OnLoadMove());
    }
	
	// Update is called once per frame
	void Update () {
	
	}
    void OnGUI() {
        if (GUILayout.Button("play")) {
            movieTexture.Play();
        }
 
    }
    IEnumerator OnLoadMove() {
        www = new WWW("file://"+datapath);
        Debug.Log(www);
        yield return www;
        movieTexture = www.movie;
        renderer.material.mainTexture = movieTexture;
        movieTexture.loop = true;
       // movieTexture.Play();
    }
}

おすすめ

転載: blog.csdn.net/www1501766557/article/details/91411631