We’re encountering a weird crash - with full debug symbols, and development mode; it seems to come down to this; which from my assessment seems to say we’re using the ThreadPool, except a full search of all the *.cs and *.js files, indicates we aren’t. It’s possible it’s a 3rd party DLL, but at this particular stage when the crash happens, we’re just doing some basic initialisation, and I don’t believe we’re calling any 3rd party functions.
Nonetheless, error is as follows - any help would be appreciated:
So, interesting update after 36 hours banging my head on this problem.
I can confirm it’s not a 3rd party library, nor any access to the Threadpool by us. I believe the cause, may actually be the LINQ .Select() operator. The crash occurs on a line which broadly reads:
Given our WebGL builds take 30 minutes to compile/test, I can’t 100% verify this as the cause (the FactoryFunction may be triggering it indirectly some how as well), but it looks like someone decided to make either AddRange or Select parallel using the ThreadPool.
ReSharper’s “Find all references” says no use of ThreadPool or the Thread classes. The Factory is the only external possibility, compile time makes it a bit difficult to test if they are at fault, but I’ll be picking this back up tomorrow to look into in more detail.
OK, so I’ve had a bit of time to look into this further today, I’m waiting for a build to go up now so I can debug further (unfortunately it’s a huge project - or I’d send it to you), but it still looks to be in that location. I traced all the code paths spawned off the factory (thankfully not many), and there really isn’t much there. I’ll see if I can rule that out entirely and get it back to the line I mentioned earlier.
Unfortunately - upgraded to 5.2 this morning, and getting thrown a new error just before where the older error was hitting, so can’t test further yet.
Invalid function pointer called with signature 'vii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)
index.html (34,7)
Invoking error handler due to
abort(303) at Error
at jsStackTrace (http://domain.com/assets/webgl/Development/WebGL.js:1011:2)
at stackTrace (http://domain.com/assets/webgl/Development/WebGL.js:1025:2)
at abort (http://domain.com/assets/webgl/Development/WebGL.js:9727920:2)
at nullFunc_vii (http://domain.com/assets/webgl/Development/WebGL.js:16118:2)
at b303 (http://domain.com/assets/webgl/Development/WebGL.js:9718614:2)
at __ZN5Unity10GameObject32ActivateAwakeRecursivelyInternalENS_19DeactivateOperationER18AwakeFromLoadQueue [Unity::GameObject::ActivateAwakeRecursivelyInternal?N()] (http://domain.com/assets/webgl/Development/WebGL.js:5739070:5)
at __ZN5Unity10GameObject24ActivateAwakeRecursivelyENS_19DeactivateOperationE [Unity::GameObject::ActivateAwakeRecursively?N()] (http://domain.com/assets/webgl/Development/WebGL.js:8709895:2)
at __ZN5Unity10GameObject10DeactivateENS_19DeactivateOperationE [Unity::GameObject::smile:eactivate?N()
UnityConfig.js (76,9)
I have the same issue with Unity 5.2 (ie.: your second issue), on a iOS build. It happens to me while unloading a scene loaded from an asset bundle (or loading a different one, hard to say).
Maybe a call stack from XCode (see attached image) will be more helpful, as it seems to contain debug infos from Unity source.
So, interesting - because we are actually unloading one scene (from asset bundles), and loading another here (albeit via a different method to the first). We delete all the content, then in the next frame (+ web download time), load the new content. I’m littering our build with debug statements at the moment, so hopefully I’ll be able to narrow down the line triggering the fault.
The crash occurs after the second instance, I thought perhaps it was unloading - after you suggested it; but no - appears to be loading. Could I ask a few specific questions:
What method are you using to unpack the asset bundle? (e.g. LoadAssetAsync?)
What’s in the bundle - is it a whole scene, or a individual gameobject - if you’re using LoadAssetAsync is it a or just a in the type parameter?
With the above said though - I just got another stack trace, and this one seems to point to “DelayedDestroy”, which might be unloading again? (just happening later.)
We’re doing something very similar here. Just trying to see what the commonalities are.
Our process is slightly different, but still broadly the same - we’re doing:
Coroutine:
Load menu scene
Delete all objects in the scene (done via foreach)
Release all memory references to objects stored in various other static classes.
Resources.UnloadUnusedAssets (could this be it?)
Create transition object (we’re still in the same “scene”)
Yield while waiting for objects to load/download via WWW.LoadFromCacheOrDownload + LoadObjectAsync. - While here, this appears to be when the new crash occurs for us now.
Instantiate objects once they’ve loaded to load new level - This is where the original crash occurred.
Synchronous loading of the scene (LoadLevel instead of LoadLevelAsync) gets a little bit further (ie.: crashes at the second LoadLevel instead of the first one) but with a different stack (see attached screenshot).