Hi All,
I have an issue. Every time I build for Master Configuration ad run my game, It crashes once i try to load a new scene after launching the game. the build file errors are attached and also a screenshot of my Visual Studio Editor is shown below.
Hi Aurimas,
Once I get the game going in debug or master’s configuration mode, with the .NET Native and code optimization checked, it works and I begin to see numerous " Skipped loading symbols. Module is native, and native debugging is currently disabled." prior to the Splash Screen of Unity showing. The first scene gets loaded, I click a button to Load the next level. It begins the loading process then crashes. The Screenshot attached shows the error.
In Visual Studio you have the output tab open at the bottom (your screenshot). There is “Call Stack” tab in that same pane, can you provide the contents of it?
I am sorry to say, but this is a known bug, but sadly it’s on Microsoft side. The game will probably runs fine if you disable .NET compilation in VS project settings. If this is really true… You need to wait until MS fixes this, hopefully with VS 2015 Update 3. At the current day, there’s no known workarounds for this bug.
I encountered a similar error over the past week. I thought it was being caused when the Scene Manager loaded a new level. This turned out to be and not be the case.
After the SceneManager loads the new level, but before it displays the new level it Destroys all the game objects in the scene it is leaving. However it appears the .Net Native does not properly Destroy the Gameobjects.
In my case I had 2 Tweens on 2 Buttons under the Canvas. I removed the scenemanager and performed a destroy on the Canvas object and the same error occurred.
So my first attempt was to Manually destroy each object in the canvas/Panel. This caused the error to go away. Even after I re-added the Scenemanager.
Upon further inspection I saw the Tween and manually killed the tween prior to the Scenemanager load. I then removed all of the manual destroy calls, but kept the Tween Kill calls prior to the scene manager load and I did not encounter the error.
A side note I have had tweens that were effecting the scale of the objects that did not cause the problem.
The error for me appears to happen when I was effecting the “fade”/Transparency of the object.
UPDATE The errors root cause appears to have came from creating the Tween(Component) in the START() function of a script. When I placed the same Component on the game Object in the Unity Editor the .Net Native was able to properly Destroy them, however if it was created/added in the script .Net native was not able to handle it ENDUPDATE
So to recap. To help debug this issue Comment out the SceneManager, Then you need to go each item and manually destroy each game object to find out which object is causing the issue. Once you find it beak the object down to fine out which sub gameobject is causing the issue. if you can find the specific object you can usually manually destroy the object to “work around” the issue.
Hope this helps for anyone who encounters this issue.
Yes… I have the exact same problem, and it happens because of DOTween.
It seems DOTween uses some kind of Try Except to Kill Active Tweens when the Current Scene Change, but this seems to be ignored when using .NET Master Configuration.
To solve this problem, You can do everything you said, or to make it more easy, just ADD an OnDisabled event to any GameObject on Scene with DOTween.KillAll(true).
Hi Tomas,
I was checking through the release notes for VS2015 Update 3 and I did not see anything relating to the issue. Do you know if they have addressed the issue.
I’m affraid Microsoft considers this “by design”. We’re trying to get the idea, how widespread the issue is, because the fix on Unity side is non-trivial and would probably affect performance a bit.
The issue occurs when you have managed code calling into native code calling back to managed code and the latter throwing exception out through native land. Currently we are investigating how widespread the issue is and how hard to avoid. So far we only got a couple of complaints about it and it tends to be possible avoid this crash by preventing exceptions from being thrown (they often are indication that something is not entirely correct with your project).
Simply put, we will only fix this bug if it’s obvious we have to, because like I said, it’s not easy and will probably have negative affect on general scripting performance.