using System.Collections; using System.Collections.Generic; using UnityEngine; public class ImageMoviePlayer : MoviePlayerBase { Texture2D texture; private void Start() { } private void Update() { } //public override bool Load(string path) public override bool Load(DShowClip path) { int width = 4; int height = 4; Color[] pix = new Color[width * height]; for (int i = 0; i < pix.Length; i++) pix[i] = Color.black; texture = new Texture2D(width, height); texture.SetPixels(pix); texture.Apply(); texture.name = "NullTexture"; StartCoroutine(LoadImage(path.fullPath)); return true; } public override Texture Texture { get { return texture; } } IEnumerator LoadImage(string path) { var www = new WWW("file://" + path); while (www.isDone == false) { yield return null; } if (www.bytes.Length > 0) { www.LoadImageIntoTexture(texture); //texture.name = Filename; texture.name = path; } else { Debug.Log(www.error); } www.Dispose(); } }