**strong text**My game was completely fine before installing Unity4 but now I get a crash to desktop 100% of the time when running the game in the editor.
I have found that the problem lies at the point of the game attempting to load an asset bundled scene.Once the bundle has successfully downloaded I try to load it. The game then crashes at the Application.LoadLevel command.
print("this doesnt print..its already crashed to desktop")
Other asset bundles (not scenes) have
been loaded fine before this code
I have Unity Pro
The scene exists at the correct path
No code was modified ..the only
change was to upgrade to Unity 4. It worked fine before the upgrade.
I have already re installed Unity
4/Rebooted many times & Cleaned the
registry & even updated my GFX drivers!
I have tried LoadLevelAsync but this
also results in the same crash.
I have tried re-bundling the scene using Unity 4.(Didn't work)
- EDIT: If I load a blank scene it works!...but if I load the scene I want with ALL Game Objects deactivated it still crashes.(Shouldn't this do exactly the same as a blank scene??)
In the editor log the crash seems to occur at:
m_ThreadCheck && Thread::mainThreadId && !Thread::CurrentThreadIsMainThread()
(Filename: C:/BuildAgent/work/812c4f5049264fad/Runtime/Utilities/MemoryPool.cpp Line: 117)
SymInit: Symbol-SearchPath: 'C:/Program Files (x86)/Unity/Editor/Data/MonoEmbedRuntime;.
It happens 100% of the time!
I tested it with a couple of different scsnes and it doesn't seem to matter which one I try to load, it always crashes here.
Any help would be gratefully received! Thanks!
Do you get any "update warnings" when you open unity editor? (eg. install windows update 5122145... for stability)
No warnings. Unity boots up nicely.
oh...I've just tried re bundling the scenes using Unity 4 (the previous ones were built with Unity 3)....but it didn't make a blind bit of difference. It still crashes really well.
Were the asset bundles built in Unity3? I would rebuild the bundles in Unity4 and try again. I may just be repeating you last comment, apologies if I am.
Yeah, I tried that. It didn't work :( Cheers
Answer by Bunny83
Jan 04, 2013 at 01:28 PM
That means you have some code on an asset in this scene which causes the crash. It looks like you used the unity api in a class constructor or field initializer. Those are executed from a different thread. I would recommend to backup the whole project and start removing your scripts from all objects (one by one) to see which one causes the error.
There's not much we can do with that little information.
I disabled all objects in the scene but I still get the crash though. Is this the expected behavior even with your solution? Do I actually need to start deleting scripts?
Disabling doesn't help. The objects are still created and deserialized. Your fault is in a class constructor or a field initializer.
Okay cool. And do you think that this kind of thing is likely to have happened because of the upgrade to Unity 4? And if so, why did it work in Unity 3.5? :)
It's likely that something in a field initializer or class constructor is attempting to access a game object or script and this isn't happening from the main thread (these things should be done in Awake) - causing the crash. It's odd that you didn't get a warning (or non-fatal error) before.
Through random trial and error, I just tried removing every object in the scene that had a font (any font) and amazingly, the scene ran! I added a brand new object GUIText to the scene with the default Arial font and the scene started crashing again. I then tried an empty scene with 'just' a guiText and this also failed.
So it looks like Its to do with fonts (maybe)...but it also looks like I cant use any fonts ever again.
Answer by grimmy
Jan 04, 2013 at 04:31 PM
In order to get the scene to load I had to delete every object from the scene which had font (seemingly).
For some reason if I add any objects (such as a default GUIText) the level load attempt will crash to desktop.
My initial scene contains fonts but is not streamed from an asset bundle.
I am now at the point where I cant load/run any scene containing fonts downloaded as asset bundles...which effectively ruins the game my team have been working hard on for the last two years.
MASSIVE ROADBLOCK HERE!
Where to next? Help!?! The only option I can see is to roll back to 3.5.
P.S> At this point in time I'm thinking 'That was £1400 well spent...NOT!'..
Why would you change developing environment after 2 years? Just curious i never was in any big project or anything.
I didn't. I just updated from Unity 3.5 to Unity 4.
I have reported this to unity and attached this portion of the game that crashes 100% of the time...
Well if you've been developing it for 2 years you have to have backups from before you upgraded, try reinstalling the last version you used and testing the build just before you upgraded.
Then when you're sure the issue is isolated to 4 try reinstalling it and converting it again. Sometimes things are nonsensically goofy like that, happened to me.
I tried re-installing Unity 4 many times. I have backups which run fine in Unity 3.5. Yes, I can continue to work using 3.5 but that doesn't help me going forward. Cheers.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
To help users post good questions and use the site effectively we have posted a user guide. Please check it out.
Answers and Comments
13 People are following this question.
Scene Variable Serialization issues on crash, save etc.
Why am I losing all scene data when loading an Asset Bundle-loaded scene?
Editor Crash: Where is Scene Data kept?
Unity Editor crashing when editing scripts referenced from GameObjects
Precomputed Realtime GI, while playing