I have been working on a game for almost 2 years now. Just the other day I started getting an error every single time I stop playing the game within the Unity IDE.
Release of invalid GC handle. The handle is from a previous domain. The release operation is skipped.
UnityEditor.SceneManagement.EditorSceneManager:OpenScene (string)
SceneAutoLoader:OnPlayModeChanged (UnityEditor.PlayModeStateChange) (at Assets/Editor/SceneAutoLoader.cs:100)
UnityEditor.EditorApplication:Internal_PlayModeStateChanged (UnityEditor.PlayModeStateChange)
I have no idea what I added or did to the game to cause this. The āSceneAutoLoader.csā is not my codeā¦ the code on line 100 is :
I see someone else submitted a bug report 6 days ago. I feel this is a newly introduce bug in Unity. Any post regarding it is quite new. Would be great to hear of a fix for this
I also updated my Unity to v.2020.3.39f1, which is a Long Term Support version. This bug has totally derailed my plans. And being new to gamedev, Iām not sure how to move forward. Does anyone have any suggestions as to how I can build my game even with this error?
UPDATE: I realized that I had a bunch of build errors and they pointed to an autosave script from Tarodev (https://github.com/Matthew-J-Spencer/Unity-AutoSave). After removing it, I am finally able to build the game! The āResolve of invalid GC Handleā error is still happening during preview, but at least itās not happening when trying to build.
So still a month later I still get this error every single time I finish running the game. Anyone know if itās safe to just ignore the error? I feel gross seeing this red error every time the game endsā¦ I see many people with this issue lately as it seems to be a new unity bug. Yet, no one has a solution
This āResolve of invalid GC handleā error also suddenly started happening to me when exiting play mode. After a while I realized that some parts of my code had different line endings (Windows style and Unix style), so I went and changed all the EOL to Windows style (I used notepad++), and that somehow solved the problem
Update: I think I have finally figured out how to reproduce the issue 100% of the time. I am really hoping to get someone from Unity to respond ( @JeffDUnity3D possibly).
The error message : Release of invalid GC handle. The handle is from a previous domain. The release operation is skipped.
How to reproduce :
1.) Run your game in the Unity Editor
2.) Make changes to the game code while the game is running
3.) Save your code and then go back to Unity. Stop the game from running. At this point when the game stops running, I have Unity set to re-import code changes (it checks for errors in your code at this time).
4.) 100% of the time Unity will report the above error
If you run your game and do not make changes to the code, the error never happens.
Resolve of invalid GC handle. The handle is from a previous domain. The resolve operation is skipped.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Trying to recreate this error but I cannot find a constant on my end.
I get it when:
Editing script when I have the script open in Unity
(This was the first instance I saw it happen. Now the error happens all the time)
Creating a 3D plane in a new project (No new assets, no new installs, just create>3D>Plane)
When importing some assets from the asset store
When deleting the main camera or adding a new camera
Double clicking the error does nothing, normally it takes you to the location of the error if itās in a script. It seems like others donāt have negative results with GC handle errors but I hate seeing an error in the console I cannot fix.
Actually i got this error from export another project data to current project and the two projects(AR & 3D) have different versions maybe reason its come to me. but what i do now
I got this error after I deleted a resource image and replaced it with a new one. The image had been used as the source image of a button. I deleted the image from the button and re-installed it. Then the error disappeared.