- Home /
Crash when displaying more than one Unity SWF
I'm using Unity Pro 4.1.0f4, Adobe Flex SDK 4.6.0.23201 with AIR 3.4 and I've run into a showstopper bug.
Every time I attempt to display two (or more) Unity SWFs in an AIR application (i.e. I load one, add it to stage, remove it from stage, forceUnload it, load another, display it etc.) Flash crashes with the following exception:
[Fault] exception, information=TypeError: Error #1034: Type Coercion failed: cannot convert System::ClassType@13ccc661 to System.Type.
at System::Type$/ForClass()
at System::CLIByteArray/CLIByteArray_Constructor_Vector$1_ByteArray()
at System::CLIArrayFactory$/NewByteArrayWithLength()
at System.Text::ASCIIEncoding/Encoding_GetBytes_String()
at UnityEngine::WWWTranscoder$cinit()
at global$init()
at UnityEngineClassIndex$/InitializeClasses()
at com.unity::UnityNative$/init_actionscript_cctors()
at com.unity::UnityNative$/Native_Init()
at com.unity::UnityContentInternal/initNativeEnvironment()
at com.unity::UnityContent/onFrameInitStep()
I'm loading the content with a flash.display.Loader with the LoaderContext's allowCodeImport set to true. On the forums someone suggested using new LoaderContext(false, new ApplicationDomain())
as the loader context, but that prevents casting the loader's content as IUnityContent
.
Has anyone else run into a similar problem? Any ideas for workarounds?
This is the problem I'm having too. It happens when I unload the Unity SWF and try to load it again in the same session