As you can see from the call stack, the code is being run from OnGUI().
I get this error when the user pops up the color selection dialog in my custom Editor class. Inside of the OnInspectorGUI method I have something like the following:
I created a new class which inherits from EditorWindow (rather than Editor) so that I can get dock/undock behavior, copied and pasted the code from the old Editor into the new EditorWindow, and the problem with the EditorGUILayout.ColorField() is gone.
This would seem to indicate a problem unique to the Editor class, but to be honest I’m no longer motivated to find out for sure. I now have a better user experience with the dockable EditorWindow and the problem isn’t exhibiting in the new implementation despite using identical code.
Thank you for taking the time to respond, I appreciate it.
Basically I was creating a new custom inspector, and within it there was a button you click to launch a custom EditorWindow.
public override void OnInspectorGUI() {
DrawDefaultInspector();
if (GUILayout.Button("Edit")) {
// Launch the editor window..
EditorWindow.GetWindow(typeof(MyEditorWindow)).Show();
}
}
‘MyEditorWindow’ in this case is just a new empty class inheriting from EditorWindow. When you click the button, the window pops up like expected - but you get that error as well.
You know, I had seen that post before, and it helped me resolve another issue, but it didn’t occur to me that it would apply here as well. Thanks, that’s good to know!
Edit : Actually, it doesn’t really apply to my exact situation, at least not directly, since it’s Unity’s GUI code itself displaying the dialog (the ColorField() method handles that internally), but it at least seems to indicate the cause and something for the Unity team to review.