This was tested on Unity 3.5.7 Pro, if it work on Unity 4+ let me know 🙂

In Unity you can lock the inspector window: http://docs.unity3d.com/Documentation/Manual/InspectorOptions.html

It’s really useful but the problem is that sometime you forget that you are locked and end up modifying values for the wrong object. If you have a custom inspector, the following code allow you to detect/display if the current inspector window is locked.

#region Display Inspector Locked Warning Type inspectorType = Assembly.GetAssembly(typeof(Editor)).GetType("UnityEditor.InspectorWindow"); Type trackerType = Assembly.GetAssembly(typeof(Editor)).GetType("UnityEditor.ActiveEditorTracker"); FieldInfo currentInspectorFieldInfo = inspectorType.GetField("s_CurrentInspectorWindow", BindingFlags.Public | BindingFlags.Static); FieldInfo currentActiveTrackerFieldInfo = inspectorType.GetField("m_Tracker", BindingFlags.NonPublic | BindingFlags.Instance); PropertyInfo isLockedPropertyInfo = trackerType.GetProperty("isLocked", BindingFlags.Public | BindingFlags.Instance); if (currentActiveTrackerFieldInfo != null && currentInspectorFieldInfo != null && isLockedPropertyInfo != null) { System.Object activeTracker = currentActiveTrackerFieldInfo.GetValue(currentInspectorFieldInfo.GetValue(null)); bool inspectorIsLocked = (bool)isLockedPropertyInfo.GetValue(activeTracker, null); if (inspectorIsLocked) { EditorGUILayout.HelpBox("EDITOR IS LOCKED", MessageType.Warning); } } #endregion

Don’t forget to add

using System.Reflection;

If you add the previous code at the start of your OnInspectorGUI() function, you get something like this when the inspector is locked. It’s not great but it’s at least better than the small lock icon 🙂