Error when swtiching between screens

Hello GameDev ladies and gentlemen. Hope you’re all good.

I took some time off the course, but on resuming it, powered up Unity Hub and it asked me to update Unity, which I did (to Version 2019.1.2f1). Now I get these “somewhat nugging” errors in the console every time I switch scenes in the editor.

Destroy may not be called from edit mode! Use DestroyImmediate instead.
Also think twice if you really want to destroy something in edit mode. Since this will destroy objects permanently.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Any one has a slight idea of how to go about fixing this error? Tried googling around but the options I see for using DestroyImmediate() are applicable to custom project scripts, and this looks like a UnityEngine script warning.

Note: Same error is repeated thrice for each scene change.

Thank you.

Hi,

Please double click on the error messages. Do they refer to a line in your code? If not, try to restart Unity.

1 Like

Thank you Nina for the promt response.

Clicking, double clicking, even tripple clicking :grinning: has proved not to be helfpul.
The only details you get in the console only point at that line…

UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

and it’s not hyperlinked, so clicking on it takes me not where.

It might be that the error message does not have anything to do with what you did in your project. Whenever the message says something about GUIUtility, it’s likely that it’s an internal problem in Unity. Try to reinstall Unity.

Was reluctant to uninstall. I will try that and get back to you. Thank you.

Just uninstalled both Unity Hub, and Unity installed a fresh versions. Reopened the project, and updated already installed packages which required updates with Package Manager but the problem still persists.

The 3 errors still show up when you transition to another screen.

What exactly do you mean by “transition to another screen”?

Did you use [ExecuteInEditMode] or [ExecuteAlways] in one of your classes?

I mean if I double click on another screen from the Assets>Scenes folder. The error shows up when another screen is loaded.

I have however noted that this might be triggered by the unloading of the old Scene(StartMenu) because I have created a a new test Scene (TestScene) within the new project, when you open TestScene from the Editor (whilst StartMenu is currently open) the error shows open. But opening StartMenu while TestScene is the one currently open does not trigger the error. :thinking:

I am planning on recreating the Scenes and copy paste the game objects maybe. Will try it later after work.

This topic was automatically closed after 14 days. New replies are no longer allowed.

Privacy & Terms