InvalidOperationException: Operation is not valid due to the current state of the object System
create a GameObject and set a public param named color.
go to Scene and editor the color param with color picker.
then throw this error. While it I don't run the game.
How can I fix it ? Or software error? In ver.5.3.4f1
I don't understand. And I don't run the game.
InvalidOperationException: Operation is not valid due to the current state of the object
System.Collections.Generic.Stack`1[System.Boolean].Pop ()
UnityEditor.EditorGUI.EndDisabledGroup () (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorGUI.cs:211)
UnityEditor.EditorGUI+DisabledGroupScope.CloseScope () (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorGUI.cs:197)
UnityEngine.GUI+Scope.Dispose ()
UnityEditor.Editor.OptimizedInspectorGUIImplementation (Rect contentRect) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/EditorBindings.gen.cs:234)
UnityEditor.GenericInspector.OnOptimizedInspectorGUI (Rect contentRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/GenericInspector.cs:33)
UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1211)
UnityEditor.InspectorWindow.DrawEditors (UnityEditor.Editor[] editors) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1028)
UnityEditor.InspectorWindow.OnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:352)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
dev code is simple:
using UnityEngine;
using System.Collections;
public class Test : MonoBehaviour {
public Color color;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
Answer by colorpillar · Apr 16, 2016 at 06:11 PM
Hello, this should be similar to this: http://answers.unity3d.com/questions/852155/invalidoperationexception-operation-is-not-valid-d-1.html
Reset your Unity layout to default and restart Unity and hopefully the problem will go away.
On my end (mac) it started after I added a Color member to a custom MonoBehaviour. From then on whenever I clicked on any colour selection panel the error popped up. For example in the Main Camera. I did have a browser-based video stream playing in full-screen on a second monitor and once I got the Color selector panel back it appeared on that monitor. Maybe that's related.
I have not overridden OnGUI or any other editor-related functionality. Restart of Unity+Mac did not help. Suggestions on the web include try/catching the Exception in OnGUI and ignoring it but that is not satisfactory.
This was my error:
InvalidOperationException: Operation is not valid due to the current state of the object System.Collections.Generic.Stack`1[System.Boolean].Pop () UnityEditor.EditorGUI.EndDisabledGroup () (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorGUI.cs:211) UnityEditor.EditorGUI+DisabledGroupScope.CloseScope () (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorGUI.cs:197) UnityEngine.GUI+Scope.Dispose () UnityEditor.Editor.OptimizedInspectorGUIImplementation (Rect contentRect) (at /Users/builduser/buildslave/unity/build/artifacts/generated/common/editor/EditorBindings.gen.cs:234) UnityEditor.GenericInspector.OnOptimizedInspectorGUI (Rect contentRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/GenericInspector.cs:33) UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1211) UnityEditor.InspectorWindow.DrawEditors (UnityEditor.Editor[] editors) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1028) UnityEditor.InspectorWindow.OnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:352) System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)