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.
No SPAM please, I'm British.
The following error is constantly repeated in the console.
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:1374)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
`- Create new Scene
2018.2.0f2
vNext-Dev
Resolved by clearing Library / Temp.
Bang and the spam is gone
Nope, came back again as soon as I hit play!
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.
I'm seeing this happen on more than just the MR Manager, and things we've written. So it's def a Unity Bug.
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 could you reply to your qa email and see if they have an ETA on this?
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
noted there are a (few) more versions of 2018.2 out now. Any chance of a re-test @pnolen ?
Still an issue as of 2018.2.4
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.
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
Regarding the "Unity Issue Tracker", it seems to be fixed. If i have time tonight, i'll try on Unity 2018.2.6f1.
Nope still broken
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
@pnolen any chance you can email to update the fogzbuz issue?
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!
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.
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!
Most helpful comment
I got an email about this issue and it states the following: