Deployed Game Crashes on Startup (Windows 7 and Mac OS X) - Movie Textures?

Hello,

I’m seeing behavior on game startup (after Unity’s splash screen) on both Windows 7 and Mac OS X Yosemite, where nearly as soon as the scene starts (a MovieTexture is rigged to play) I get a crash with the following trace. Sometimes I’m able to coax it into not crashing just by restarting and starting again, but most of the time I see the following crash trace:

Receiving unhandled NULL exception
Obtained 18 stack frames.
#0  0x00000100e39a8c in BaseVideoTexture::UpdateVideoTextures()
#1  0x00000100a4e1ec in PlayerLoop(bool, bool, IHookEvent*)
#2  0x000001010632b1 in -[PlayerAppDelegate UpdatePlayer]
#3  0x007fff9328c953 in __NSFireTimer
#4  0x007fff8e5df2e4 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
#5  0x007fff8e5def73 in __CFRunLoopDoTimer
#6  0x007fff8e65253d in __CFRunLoopDoTimers
#7  0x007fff8e59a608 in __CFRunLoopRun
#8  0x007fff8e599bd8 in CFRunLoopRunSpecific
#9  0x007fff9a63156f in RunCurrentEventLoopInMode
#10 0x007fff9a6312ea in ReceiveNextEventCommon
#11 0x007fff9a63112b in _BlockUntilNextEventMatchingListInModeWithFilter
#12 0x007fff8ea8d8ab in _DPSNextEvent
#13 0x007fff8ea8ce58 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
#14 0x007fff8ea82af3 in -[NSApplication run]
#15 0x007fff8e9ff244 in NSApplicationMain
#16 0x00000101062ea2 in PlayerMain(int, char const**)
#17 0x000001000020b4 in start

Stacktrace:

Native stacktrace:

0   libsystem_kernel.dylib              0x00007fff97bec286 __pthread_kill + 10
1   libsystem_c.dylib                   0x00007fff97e3ab53 abort + 129
2   build_v4                            0x0000000100abc944 _Z12HandleSignaliP9__siginfoPv + 36
3   libmono.0.dylib                     0x000000010246a50a mono_chain_signal + 71
4   libmono.0.dylib                     0x00000001023b7a33 mono_sigsegv_signal_handler + 213
5   libsystem_platform.dylib            0x00007fff93e26f1a _sigtramp + 26

Debug info from gdb:

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

The trace on Line 3, leads me to believe something is going awry with my MovieTexture. The MovieTexture is packaged with the build. As soon as I remove the code to play the texture, no crashes occur. For what it’s worth the following lines are called in a script’s Start() method:

AudioSource aud = GetComponent<AudioSource>();
MovieTexture movie = image.texture as MovieTexture;
movie.loop = loop;
movie.Play();
aud.clip = movie.audioClip;
aud.Play();

Can someone please point me in the right direction?

FWIW I’ve come to a work-around, without a whole lot of understanding of exactly what was happening. We narrowed it down to a possible race condition inside Mono/Unity’s BaseVideoTexture::UpdateVideoTextures() method. Upon scene unload/new scene load, a SIGSEGV is raised and wrapped by magical Unity things, and made to appear as a SIGABRT.

My work around was to call Destroy() on the RawImage I was using to access the MovieTexture, and THEN call Application.LoadLevel() as normal. While I’m happy the game is functional again, I would still really like to know exactly what was going on to better understand the problem.

best regards!

This actually hasn’t been solved and is still an issue (tested on Unity 5.2.3). The work-around does improve things a bit it seems, but we’re still seeing occasional crashes.

@jeroen-akershoek I agree. I still see it in Unity 5.3 I’ve searched for how to submit an issue to the issue tracker, but I’ve yet to find a way. I was going to wait and ask around at GDC 2016 to see if anyone knew of the issue.

Within Unity open the Help drop down from the toolbar and select Report a bug.

1 Like

Thanks @Metastable

Just discovered the same issue in 5.30f4

Do you guys have a case number yet? Please share so I can refer to it.

Yes, the case number I have is: 753985

Thanks.
What was your workaround exactly? Calling destroy in my preloader wont work since it crashes right at the very start.

What seems to work for us is making sure the MovieTexture isn’t playing (if it is, call Stop()), and likewise with any audio clip associated with it. Then I destroy the RawImage object I have associated the MovieTexture to, and then I load the next scene with Application.LoadLevel();

Aha thanks. For me it crashes at startup so I use the platform compile flags to not compile ANY code with movietextures on mac (image fallback)

Just noticed this problem is still around in 5.3.3p1? Did they make any progress on your ticket?

Just checked and there hasn’t been any movement. I’m hopong to discuss the bug with someone on staff with Unity at GDC in a few weeks.