title: How to change Movie Textures in runtime in Unity Pro?
body: <p>I have a couple of videos in Unity Pro which I can play through an object and a MovieTexture. Through the inspector I manually set the MovieTexture to be one of the .ogg videos I have and it plays successfully.</p>
  
  <p>What I want to do is to change the Movie Texture in runtime, through code, when certain conditions are met (for the sake of simplicity, something like when you press the space bar the video currently playing changes to another video).</p>
  
  <p>What <strong>currently works for me but using the inspector</strong> is this:</p>
  
  <pre><code>MovieTexture movTex;
  AudioSource movAudio;
  
  void Start()
  {
      // I have set the movie manually through the inspector by drag and drop
      // onto the texture component
      movTex = (MovieTexture)GetComponent&lt;Renderer&gt;().material.mainTexture;
      movAudio = GetComponent&lt;AudioSource&gt;();
      movAudio.clip = movTex.audioClip;
      movTex.Play(); // Autoplay on start
      movAudio.Play();
      movTex.loop = true; // Loop forever
      ...
  }
  </code></pre>
  
  <p>And I have already tried the code that I found on <a href="https://forum.unity3d.com/threads/loading-audio-and-video-from-resources-folder.7418/#post-92935" rel="nofollow noreferrer">this post</a>, putting of course my desired videos under Resources folder, but it doesn't work. A plain white texture with no audio is what I'm getting. </p>
  
  <p>This is the code <strong>I'm trying to make to work but I can't</strong>:</p>
  
  <pre><code>MovieTexture movTex;
  AudioSource movAudio;
  
  void Start()
  {
      movTex = (MovieTexture) Resources.Load( "V00001" , typeof( MovieTexture ) );
      transform.renderer.material.mainTexture = movie;
      transform.audio.clip = movie.audioClip;
      movAudio = GetComponent&lt;AudioSource&gt;();
      movAudio.clip = movTex.audioClip;
      movTex.Play(); // Autoplay on start
      movAudio.Play();
      movTex.loop = true; // Loop forever
      ...
  }
  
  void Update()
  {
      if("Spacebar is pressed"){
          movTex = (MovieTexture) Resources.Load( "V00001" , typeof( MovieTexture ) );
          movAudio = GetComponent&lt;AudioSource&gt;();
          movAudio.clip = movTex.audioClip;
          movTex.Play(); // Autoplay on start
          movAudio.Play();
          movTex.loop = true; // Loop forever
      }
      ...
  }
  </code></pre>
  
  <p>What am I doing wrong?</p>