I've been using Unity for a few months now and it has been pretty stable, minus a rare few odd editor crashes. Within the past week, debugging using Visual Studio 2015 has become so unstable to the point where now it seems if I even look at the "Attach to Unity" button on VS2015 wrong it will crash the Unity editor.
**Problem**
It was okay for a good long time. Then starting this past Staurday, using "Attach to Unity" became unstable: running the game from the editor would usually crash Unity with the bug reporter if VS was attached. It seems based on time I (my own initialization code?). The game would run just fine without VS attached.
As of today, "Attach to Unity and Play" became as unstable and because it starts the game, the crash is more problematic.
I honestly don't know what prompted this to start. I suspect some code of mine but I do not know where to look because I don't know what would set the editor off like this.
**Troubleshooting**
I've already tried deleting the UnityAssemblies folder in my project Library folder. Didn't help.
I've also submitted multiple crash reports through the reporter but as right now I seem almost incapable of debugging through VS, I'm here.
It does work through MonoDevelop but I really prefer Visual Studio.
**Quick Facts**
* Unity 5.4.2f2 Personal.
* Unity Tools for VS 2015 2.3.0.
* Visual Studio 2015 Professional Update 3 (14.0.25431.01) with .NET 4.6.01586.
* My project isn't that large. It's just one scene with code ported from an older game of mine written in C++. The implementation isn't finished so it's not as large as the old C++ version, and that was a fairly small game still. There is no unsafe code in the Unity version. All existing code is in C#.
* The game runs fine if I don't have VS attached to debug.
* The last 3 times I pushed "Attach to Unity and Play", it starts. I trigger a breakpoint, hit Step Over and Unity throws up the "Unity Editor has stopped working" dialog. If I Step Into this code and run it that way it's okay but does stick for a good few seconds when it should finish immediately. (It certainly does in the C++ version or if I don't have VS attached.)
* There is a bit of static initialization in some classes the above line of code hits. A few static dictionaries but they aren't large and number under 15.
* As I write this, I was able to start the game, let it run for a bit then attach VS and Step Over worked.
* But, when I stopped the game with VS still attached and hit Play on Unity, it crashed, this time with the Unity bug reporter.
* I can near-consistently crash the editor by leaving VS attached and hitting Play on the editor.
This makes me want to go back to my own game engine, and I stopped because I was able to complete so much more in a short amount of time (it helps that it looks prettier).
↧