x


How can I stop my editor from crashing everytime it loads a new Scene during runtime? (since Unity 4)

**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.

  if(Application.CanStreamedLevelBeLoaded(sceneName))
 {
     print("this prints");
     Application.LoadLevel(sceneName);//CRASH HERE
     print("this doesnt print..its already crashed to desktop")
 }

To note:

  • Other asset bundles (not scenes) have

been loaded fine before this code executes. - I have Unity Pro - The scene exists at the correct path (double checked) - 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)
     
 Crash!!!
 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!

Eek!

more ▼

asked Jan 03, 2013 at 11:40 AM

grimmy gravatar image

grimmy
495 143 591 172

Do you get any "update warnings" when you open unity editor? (eg. install windows update 5122145... for stability)

Jan 03, 2013 at 12:05 PM Lovrenc

No warnings. Unity boots up nicely.

Jan 03, 2013 at 12:13 PM grimmy

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.

Jan 03, 2013 at 11:25 PM grimmy

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.

Jan 04, 2013 at 10:15 AM Caiuse

Yeah, I tried that. It didn't work :( Cheers

Jan 04, 2013 at 10:16 AM grimmy
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered Jan 04, 2013 at 01:28 PM

Bunny83 gravatar image

Bunny83
78.4k 26 107 339

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?

Jan 04, 2013 at 01:35 PM grimmy

Disabling doesn't help. The objects are still created and deserialized. Your fault is in a class constructor or a field initializer.

Jan 04, 2013 at 01:41 PM Bunny83

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? :)

Jan 04, 2013 at 01:53 PM grimmy

Okay, well I went through the scene deleting objects one by one, creating a new scene asset bundle and trying to download it. Each time (the scene contained around 20 objects) the load crashed until I had no objects left in the scene at all. The same scene with no objects in loaded fine. I then tried the complete scene but with just the last object that I removed but still it crashed. (So now I've tested every object in this scene to see if it's the culprit)

SO, it doesn't look like any script or Game Object is messing this up at all. Maybe something buried deep in a scenes 'settings' if such a thing exists?

Any more ideas?

Jan 04, 2013 at 03:11 PM grimmy

I also tried removing all the objects from the scene and then adding a brand new object. This scene also loaded correctly. (??!?!!)

Jan 04, 2013 at 03:16 PM grimmy
(comments are locked)
10|3000 characters needed characters left

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.

Cheers P.S> At this point in time I'm thinking 'That was £1400 well spent...NOT!'..

more ▼

answered Jan 04, 2013 at 04:31 PM

grimmy gravatar image

grimmy
495 143 591 172

Why would you change developing environment after 2 years? Just curious i never was in any big project or anything.

Jan 04, 2013 at 04:33 PM Lovrenc

I didn't. I just updated from Unity 3.5 to Unity 4.

Jan 04, 2013 at 04:37 PM grimmy

I have reported this to unity and attached this portion of the game that crashes 100% of the time...

Jan 04, 2013 at 05:16 PM grimmy

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.

Jan 04, 2013 at 09:28 PM MibZ

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.

Jan 05, 2013 at 06:02 AM grimmy
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2767
x1197
x980
x22

asked: Jan 03, 2013 at 11:40 AM

Seen: 3275 times

Last Updated: Jan 22, 2013 at 06:08 PM