我有一个团结项目,我从磁盘上的文件夹加载多个ogv-videos。当我在调试模式下运行游戏时它运行得很好,但是当我构建游戏时视频无法加载
public class Video
{
public MovieTexture movieTexture { get; set; }
public string title { get; set; }
}
public class VideoLoader : MonoBehaviour {
public static List<Video> allVideos;
// Use this for initialization
void Start () {
StartCoroutine(LoadAllVideos());
}
IEnumerator LoadAllVideos()
{
allVideos = new List<Video>();
string path = "C:/Users/Bram Sikkens/Desktop/SealifeBestanden/ProductBestanden";
string[] videoFilePaths = Directory.GetFiles(path, "*.ogv");
for(int i =0; i< videoFilePaths.Length;i++)
{
WWW diskMovieDir = new WWW("file://" + videoFilePaths[i]);
while(!diskMovieDir.isDone)
{
yield return null;
}
Video v = new Video();
v.movieTexture = diskMovieDir.GetMovieTexture();
v.title = videoFilePaths[i];
allVideos.Add(v);
}
foreach (GameObject menu in ProductContainers.menuGameObjects)
{
foreach(Video video in allVideos)
{
if(video.title.Contains(menu.name))
{
menu.transform.GetChild(2).GetComponent<Renderer>().material.mainTexture = video.movieTexture;
video.movieTexture.Play();
video.movieTexture.loop = true;
}
}
}
}
}
当我制作时,他的视频运行的原因是什么?