consulo / consulo-unity3d

Frameworks: Unity3D
Apache License 2.0
103 stars 10 forks source link

Unity Editor crashes in debug mode on classes extended from MonoBehaviour #55

Closed Sipaha closed 8 years ago

Sipaha commented 8 years ago

This problem appeared after today changes. Reason is something with acces violation:

KERNELBASE.dll caused an Access Violation (0xc0000005) in module KERNELBASE.dll at 0033:e7f38b9c.

error.txt

VISTALL commented 8 years ago

Idk - i cant repeat it. I working with Unity while testing, and its never crashed.

Sipaha commented 8 years ago

Ok, I will try collect more information about the problem

Sipaha commented 8 years ago

Maybe this video and test project will help to repeat it

https://youtu.be/AJPo0dafIZg

UnityEditorCrashTest.zip

VISTALL commented 8 years ago

lol

litte later i will test it in other Unity builds, maybe its a Unity bug

Thanks

VISTALL commented 8 years ago

Reproduced. Thanks

VISTALL commented 8 years ago

You are trying to create a MonoBehaviour using the 'new' keyword.  This is not allowed.  MonoBehaviours can only be added using AddComponent().  Alternatively, your script can inherit from ScriptableObject or no base class at all
UnityEngine.MonoBehaviour:.ctor()
NotBehaviour:SomeMethod() (at Assets/NotBehaviour.cs:10)
TestScript:Start() (at Assets/TestScript.cs:8)

Strange

VISTALL commented 8 years ago

Cant repeat at MonoDevelop. null value exists too, but no crash when i go inside

Sipaha commented 8 years ago

You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed.

Yes, "new MonoBehaviour()" here just for test and some versions of Unity may show error like this. Here test project with tag "Test" on GameObject and "GameObject.FindGameObjectWithTag("Test").GetComponent()" instead of "new MonoBehaviour()" UnityEditorCrashTest.zip

Problem reproduced if breakpoint located above of behaviour initialization.

null value exists too

I think null here is just ToString realization and not bug. Also Unity have custom behaviour for '==' operator which can return true in comparison with null, but it's can be not true.

VISTALL commented 8 years ago

Fixed. Please update .NET plugin after one hour