Build crashing when loading video textures (not in the Editor)

Hi there,

First off, sorry if this does not belong here (I wasn’t sure about posting it in this forum or in Scripting). I have an empty scene that contains 2 videos, the Epilogue of the game (skippable) and the Credits (skipping leads to MainMenu). I had those cutscenes added to the scene, but the build always crashed when loading it, so I now tried loading them from Resources, but it is also crashing. Both cutscenes (very long, and at a 1080p resolution) are a 400MB total in weight, but the computer is not, by any chance, running out ot RAM, so maybe it is a bandwidth issue?

I load all the scenes through an empty scene with a progress animated icon, it unloads the previous scene and assets and then loads asynchronously the next one. Here’s my code for the cutscenes in case it helps:

void Start()
    {
        StartCoroutine(LoadCutscene());
    }

IEnumerator LoadCutscene()
    {
        ResourceRequest resourceRequest = Resources.LoadAsync<MovieTexture> ("Cutscenes/Epilogue");

        while (!resourceRequest.isDone) {
            yield return null;
        }

        if(resourceRequest.isDone)
        {
            movie = (MovieTexture) resourceRequest.asset;
  
            StartPlay();
        }
    }

void StartPlay()
    {
        cinematic_canvas.material.SetTexture("_MainTex",movie);
        cinematic_canvas.material.SetColor("_Color",Color.white);

        _mt = (MovieTexture)cinematic_canvas.material.GetTexture("_MainTex");
        if(_mt != null)
            _mt.Play();

        _cutscenePlaying = true;
        StartCoroutine(LoadCredits());
    }

IEnumerator LoadCredits()
    {
        ResourceRequest resourceRequest = Resources.LoadAsync<MovieTexture> ("Cutscenes/EndCredits");

        while (!resourceRequest.isDone) {
            yield return null;
        }

        if(resourceRequest.isDone)
            cMovie = (MovieTexture) resourceRequest.asset;
    }

Do you know what might I be doing wrong? Thanks for your time.

I hate to be the barer of bad news, but you really, really gotta not use MovieTextures. Here’s why:

On the Manual page for movie textures, they say “Video files are imported via Apple QuickTime” … “On Windows movie importing requires Quicktime to be installed”. So basically, users must have quicktime installed to run unity games that have MovieTextures. Unity - Manual: Movie Textures

In April, Apple announced that they no longer support QuickTime for Windows, meaning they will no longer update security and other features. This creates a huge vulnerability in Windows and opens up your Windows computer to potential viruses or the possibility of having your information stolen. It is unsafe for a Windows computer to have QuickTime anymore. http://blog.trendmicro.com/urgent-call-action-uninstall-quicktime-windows-today/

So I hate to say it, but you should not use MovieTextures unless you’re building a game exclusively for mac.

Check the asset store for add-ons that allow you to play videos without quicktime. They’ll likely cost money, but MovieTextures are not an option anymore.

1 Like