MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

Console Error Spam - Set_type is not allowed on ScriptableObject constructor

Open SimonDarksideJ opened this issue 8 years ago • 18 comments

Overview

In the latest branch of mrtk_dev, the console is getting spammed when viewing profiles or clicking round the editor.

Could possibly be a Unity bug but needs investigating.

Expected Behavior

No SPAM please, I'm British.

Actual Behavior

The following error is constantly repeated in the console.

See "Script Serialization" page in the Unity Manual for further details.
UnityEngine.Event.KeyboardEvent (System.String key) (at C:/buildslave/unity/build/Modules/IMGUI/Event.cs:153)
UnityEditor.ObjectSelector..cctor () (at C:/buildslave/unity/build/Editor/Mono/ObjectSelector.cs:78)
Rethrow as TypeInitializationException: The type initializer for 'UnityEditor.ObjectSelector' threw an exception.
UnityEditor.EditorGUIUtility.GetObjectPickerControlID () (at C:/buildslave/unity/build/Editor/Mono/EditorGUIUtility.cs:1426)
Microsoft.MixedReality.Toolkit.Inspectors.MixedRealityManagerInspector.OnInspectorGUI () (at Assets/MixedRealityToolkit/_Core/Inspectors/MixedRealityManagerInspector.cs:66)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, System.Int32 editorIndex, System.Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1374)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Steps to reproduce

`- Create new Scene

  • Select the MixedRealityDefault Profile
  • Select yes to add manager to the scene
  • Click on Mixed Reality manager

Unity Editor Version

2018.2.0f2

Mixed Reality Toolkit Release Version

vNext-Dev

SimonDarksideJ avatar Jul 18 '18 12:07 SimonDarksideJ

Resolved by clearing Library / Temp. Bang and the spam is gone

SimonDarksideJ avatar Jul 18 '18 15:07 SimonDarksideJ

Nope, came back again as soon as I hit play!

SimonDarksideJ avatar Jul 18 '18 15:07 SimonDarksideJ

I think this is something that Unity changed. pre 2018.2 used to be fine. Not sure what the new workflow is.

This has been bugging me the last day or so as well.

StephenHodgson avatar Jul 18 '18 16:07 StephenHodgson

I'm seeing this happen on more than just the MR Manager, and things we've written. So it's def a Unity Bug.

StephenHodgson avatar Jul 18 '18 18:07 StephenHodgson

I was able to reproduce this with a very simple project without vNext in it. The call causing this error is EditorGUIUtility.GetObjectPickerControlID(), and the EditorGUIUtility.GetObjectPickerObject() gives the same error.

Bug report submitted but not accepted yet: https://fogbugz.unity3d.com/default.asp?1061966_m7oap09fs4irruag

pnolen avatar Jul 19 '18 00:07 pnolen

@pnolen could you reply to your qa email and see if they have an ETA on this?

StephenHodgson avatar Aug 14 '18 22:08 StephenHodgson

No ETA. They are still investigating.

Issue tracker is here: https://issuetracker.unity3d.com/issues/unityexception-is-thrown-when-calling-editorguiutility-objectpicker-methods-from-custom-editor

pnolen avatar Aug 17 '18 22:08 pnolen

noted there are a (few) more versions of 2018.2 out now. Any chance of a re-test @pnolen ?

SimonDarksideJ avatar Aug 20 '18 12:08 SimonDarksideJ

Still an issue as of 2018.2.4

pnolen avatar Aug 20 '18 17:08 pnolen

One thing I noticed is that everything works fine until the scripts recompile. I think it has something to do with the ObjectSelectorReceiver that the ObjectSelector window is now using to raise events. Odd thing is that they didn't hook it up anywhere in EditorGUIUtility.

StephenHodgson avatar Aug 24 '18 16:08 StephenHodgson

Another release @pnolen Do you want to update the Unity issues as it appears they haven't fixed it AGAIN :P (well not according to the release notes) Anyone able to re-test in 2018.2.6

SimonDarksideJ avatar Aug 31 '18 09:08 SimonDarksideJ

Regarding the "Unity Issue Tracker", it seems to be fixed. If i have time tonight, i'll try on Unity 2018.2.6f1.

architekth avatar Aug 31 '18 16:08 architekth

Nope still broken

StephenHodgson avatar Aug 31 '18 16:08 StephenHodgson

I try on Unity 2018.2.6f1 and i confirm that the issue is still there, everytime i click on MixedRealityManager, an error occured :

UnityException: set_type is not allowed to be called from a ScriptableObject constructor (or instance field initializer), call it in OnEnable instead. Called from ScriptableObject 'ObjectSelector'. See "Script Serialization" page in the Unity Manual for further details. UnityEngine.Event.KeyboardEvent (System.String key) (at C:/buildslave/unity/build/Modules/IMGUI/Event.cs:153) UnityEditor.ObjectSelector..cctor () (at C:/buildslave/unity/build/Editor/Mono/ObjectSelector.cs:78) Rethrow as TypeInitializationException: The type initializer for 'UnityEditor.ObjectSelector' threw an exception. UnityEditor.EditorGUIUtility.GetObjectPickerControlID () (at C:/buildslave/unity/build/Editor/Mono/EditorGUIUtility.cs:1426) Microsoft.MixedReality.Toolkit.Inspectors.MixedRealityManagerInspector.OnInspectorGUI () (at Assets/MixedRealityToolkit/_Core/Inspectors/MixedRealityManagerInspector.cs:66) UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor[] editors, System.Int32 editorIndex, System.Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1367) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Unity Version : 2018.2.6f1 MRTK-vNext version : mrtk_development branch Unity Build Settings : UWP

architekth avatar Aug 31 '18 17:08 architekth

@pnolen any chance you can email to update the fogzbuz issue?

SimonDarksideJ avatar Aug 31 '18 17:08 SimonDarksideJ

There's some news today regarding this bug from Unity here : https://fogbugz.unity3d.com/default.asp?1061966_m7oap09fs4irruag Apparently, this issues is fixed on Unity 2018.3 and they should backport the fix on Unity 2018.2 "in the near futur". So maybe for Unity 2018.2.7f1 ? Hope very soon!

architekth avatar Sep 03 '18 10:09 architekth

I figure we are guessing this is potentially fixed in 2018.3, since the fogbuz issue is now closed as identified and the issue tracker says fixed in next release. Given this still isn't fixed in 2018.2, I'm sceptical it'll be back-ported, seeing it's likely a fundamental editor issue for them to fix in a different build to the one it was found in. But fingers crossed.

SimonDarksideJ avatar Sep 03 '18 10:09 SimonDarksideJ

I got an email about this issue and it states the following:

We have fixed this issue and it will not appear in the upcoming Unity 2018.3 version. There should be a backport to Unity 2018.2 version in the near future too.

I will be closing this case now. Any further reply will reopen it, so if you have any questions, feel free to contact us!

pnolen avatar Sep 04 '18 17:09 pnolen