Поскольку я не могу ответить на вопросы в комментарии к вашей первоначальной, следующая попытка - ответить на то, что я знаю.
В вашем первом заявлении после отладочного вызова вы устанавливаете компонент maintexture экземпляра материала myMovie, в зависимости от шейдера это может работать или не работать как «mainTexture», возможно, не ссылается на текстуру, которую вы ожидаете.
Вы можете застраховать вы нажмете нужную текстуру, используя следующий метод
//Note the diffrence between a material instance and the shared material
//... dont forget to clean up instances if you make them which hapens when you call .material
Material instancedMaterial = gameObject.GetComponent<Renderer>().material;
Material sharedMaterial = gameObject.GetComponent<Renderer>().sharedMaterial;
//_MainTex is the name of the main texture for most stock shaders ... but not all
//You can select the shader by clicking the gear in the inspector of the material
//this will display the shader in the inspector where you can see its properties by name
instancedMaterial.SetTexture("_MainTex", movie);
Следующий код из объекта рабочего класса я использую, чтобы установить объект Unity UI RawImage, чтобы сделать фильм. Из того, что я вижу в вашем примере, у вас есть часть фильма правильно, я подозреваю, что ваша проблема связана с параметром шейдера.
using UnityEngine;
using System.Collections;
public class RawImageMovePlayer : MonoBehaviour
{
public UnityEngine.UI.RawImage imageSource;
public bool play;
public bool isLoop = true;
public MovieTexture movie;
// Use this for initialization
void Start()
{
movie = (MovieTexture)imageSource.texture;
movie.loop = isLoop;
}
// Update is called once per frame
void Update()
{
if (!movie.isPlaying && play)
movie.Play();
}
public void ChangeMovie(MovieTexture movie)
{
imageSource.texture = movie;
this.movie = (MovieTexture)imageSource.texture;
this.movie.loop = isLoop;
}
public void OnDisable()
{
if (movie != null && movie.isPlaying)
movie.Stop();
}
}
В журнале появляется сообщение «начать ввод»? – phil652