- Home /
Question by
nitrogencrystal · Aug 20, 2015 at 05:18 PM ·
unity5unityeditor
UnityEngine.MovieTexure is required access, Help?
this is the script for playing the movie on gameobject
#pragma strict
RequireComponent(AudioSource);
// Assigns a movie texture to the current material and plays it.
var movTexture : MovieTexture;
function Start () {
GetComponent.<Renderer>().material.mainTexture = movTexture;
var aud: AudioSource = GetComponent.<AudioSource>();
aud.clip = MovieTexture.audioClip();
movTexture.Play();
aud.Play();
}
aud.clip = MovieTexture.audioClip(); keeps coming up with error: UnityEngine.MovieTexture is required access?
how do i fix this? thanks
Comment
Answer by Landern · Aug 20, 2015 at 05:19 PM
Use the instance you should be assigned, "movTexture".
Change line 12 from:
aud.clip = MovieTexture.audioClip();
to
aud.clip = movTexture.audioClip();