loading video texture from streaming assets

I want to load a video texture from streaming assets so that I can trade out the video file manually without having to recompile. I have a file in streaming assets called 1.mov.

Should my c# look something like this:?

using UnityEngine;
using System.Collections;

public class video : MonoBehaviour {

    public MovieTexture movie;

    // Use this for initialization
    void Start () {
        string movieTexturePath =Application.streamingAssetsPath + "/1.mov";
        movie = (MovieTexture)Resources.Load (movieTexturePath, typeof(MovieTexture));
        renderer.material.mainTexture = movie as MovieTexture;
        movie.loop = true;
        movie.Play ();



It’s important to note that Resources and StreamingAssets are two distinct Unity features – they don’t mix at all.

Resources are built and compressed Unity assets, created in the editor at the time of the build. This is handy because you can access assets from your project without having them in a scene ahead of time, but the assets must still be in the project at the time it’s built.

StreamingAssets allows you to include raw files in your build. Those files could be replaced, later. Unity’s ability to import assets is mostly limited to the editor; at runtime, you’ll have to handle the file differently. You can stream textures using the WWW class, for example, up to and including movie textures.

The scripting reference for WWW.movie has some example code that you can follow. This might seem unusual, but it’s possible to use WWW to load files on the end user’s machine (just prefix the path with file:// instead of http://).