Error crashes Unity

I exit Unity and reopened it after an hour. Than this error popped in the console from nowhere:

TypeLoadException: Could not load type 'mac10' from assembly '060f4bec5cb14154b8434818c406c291, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider obj, System.Type attributeType)
System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit)
System.MonoType.GetCustomAttributes (System.Type attributeType, Boolean inherit)
UnityEngine.AttributeHelperEngine.CheckIsEditorScript (System.Type klass) (at E:/BuildAgent/work/71ca6fec1b41cc30/Runtime/Export/AttributeHelperEngine.cs:63)

Now when I run the level, Unity crashes. Just before I exit Unity, I build the level and the build is working perfectly. I just built it and exit Unity, I made no changes to the scene or to the assets.
What could it be? “mac10” is one of the weapons in the game, I have a script, called mac10, a model, and a prefab, they are all there.

I am experiencing the same issue, reported here: http://forum.unity3d.com/threads/66914-Crash-on-play-in-3.1-worked-fine-in-3.0?highlight=TypeLoadException

One thing I’ve noticed is that some of my scenes don’t crash the editor when I play them. And sometimes the editor crashes simply on opening a scene.

Can you do me a favor and check something? Open a scene of yours that doesn’t crash the editor and play that scene. Then try to open a scene that would crash the editor if you played it. Does opening the scene itself crash the editor?

Check this out, the problem could have to do with the new .NET DLL feature: http://forum.unity3d.com/threads/59072-Making-a-plugin-using-C

Our assemblies are in hex compared to tonyoakden’s assembly. Maybe there’s some weird problem with .NET compatibility since he was having troubles with a 4.0-compiled script.

In my case, my scripts are being compiled in the editor itself, but with this new feature the compilation must have changed since assemblies are now referred to as a hex key. Maybe this is a regression from .NET version support from Unity 3.0?

What are you using in “mac10”? Any generic .NET features? List<> perhaps?

I just did this and yes, opening the scene crashes the editor after I have played a scene, that doesn’t crash.
I see you are with 3.1 version of the editor. Me too, but I’m with it since it was up for download (a week or so?) and this happened now.

And no, I have a .Net feature in one of the scenes, that don’t crash. Mac10 is jsut a weapon script, simmilar to the other weapon scripts in my game, nothing special in it.

I also tried to select a different weapon from the menu scene, that doesn’t crash, so mac10 won’t be used, but it still crashed.

Yeah this just happened to me yesterday. I downloaded it and played with it for a day before this happened.

That’s good to hear you can confirm that same thing.

And I checked to see about using System.Collections.Generic, but some scripts that get the exception do and some don’t. I have 12 total, maybe out of 25-30 in my project? So I guess I’m out of ideas :stuck_out_tongue:

Alright, here’s some more news: I tried building the game with the error in the console. It got built and I started it. I used the mac10 weapon in the menu and started the level, that crashed in the editor. The weapon was however malfunctioning. The other weapons work, but this speciffic one didn’t.

Also:
While building I received those two messages ( ot whatever the yellow triangle icons called):

I only understand most of the things in the console, that are script - related, so I tought, that it’s telling me, that the mac10 script is missing from the mac10 prefab, but it was there…

I should have posted this in the Support section.