Load video from external path to RawImage canvas
I am new in unity, I am trying to load video file in a rawimage canvas. The video file is located outside the assist folder for the project.
private MovieTexture nt;
private AudioSource AD;
private RawImage rim;
void Start()
{
AD = GetComponent<AudioSource>();
rim = GetComponent<RawImage> ();
rim.texture = (MovieTexture)Resources.Load (@"E:\unity Videos\11.mp4");
nt = (MovieTexture)rim.texture;
AD.clip = nt.audioClip;
nt.Play ();
AD.Play ();
}
but I am getting the following error message:
InvalidCastException: Cannot cast from source type to destination type.
So what do I miss ?
Thanks in advance
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612093656im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Failed to start the Unity Package Manager local server process 0 Answers
Unity3d 5.2.2 Runtimecontroller in Animation 0 Answers
mesh generation with mouse input inity 0 Answers
How to repair this? 1 Answer
not run app again when read nfc tag 0 Answers