Hi there, I’m new to Unity (using 5.6.2f1) and I’ve read a few discussion over the years about video issues but I still can’t have video inside unity.
So I tried .mp4, mwv and ogv and none of them works. Actually ogv it’s the only format which doesn’t throw errors, however I still can’t link it to my movietexture (I get a forbidden icon when I try to link it to my variable, nothing in the console).
If I apply the transcode I’ll get a warning about an issue with 30 audio samples but that’s it. the import seems to be fine as I can preview the video in the top left part of the screen.
This is the simple script I am using (taken from this video
)
Any help please?
Thank you!
public class playVideo : MonoBehaviour {
public MovieTexture movie;
private AudioSource audio;
// Use this for initialization
void Start () {
GetComponent<RawImage>().texture = movie as MovieTexture;
audio = GetComponent<AudioSource>();
audio.clip = movie.audioClip;
movie.Play();
audio.Play();
}
// Update is called once per frame
void Update () {
if(Input.GetKeyDown(KeyCode.Space) && movie.isPlaying)
{
movie.Pause();
}
else
{
movie.Play();
}
}
}