Unity-Technologies/UnityCsReference · error · ArgumentException

Recursive EnableLivePropertyFeature are not allowed.

Error message

Recursive EnableLivePropertyFeature are not allowed.

What it means

Thrown by Internal_HasLiveProperties when the cached serialized object already holds a non-zero native pointer, indicating EnableLivePropertyFeature was called recursively (re-entered) before the previous call completed. The live-property feature is not re-entrant.

Source

Thrown at Editor/Mono/InspectorUtility.cs:109

                    continue;

                // Callback
                var editor = editors[i];
                if (IsLivePropertyChanged(editor))
                    editor.isInspectorDirty = true;
            }
        }

        // Check if current serialized object contains any live properties.
        // If so, enable live property feature.
        [RequiredByNativeCode]
        internal static bool Internal_HasLiveProperties(IntPtr nativeObjectPtr)
        {
            if (!EditorApplication.isPlaying || s_LivePropertyOverrideCallbacks.Count <= 0)
                return false;

            if (s_CachedSerializedObject.m_NativeObjectPtr != IntPtr.Zero)
                throw new ArgumentException("Recursive EnableLivePropertyFeature are not allowed.");

            var livePropertyFeatureEnabled = false;

            try
            {
                s_CachedSerializedObject.m_NativeObjectPtr = nativeObjectPtr;
                var target = s_CachedSerializedObject.targetObject;
                if (target == null)
                    return false;

                var targetType = target.GetType();

                if (s_LivePropertyOverrideCallbacks.ContainsKey(targetType))
                {
                    livePropertyFeatureEnabled = true;
                }
            }
            finally

View on GitHub (pinned to 225b0fbdb5)

Solutions

  1. Avoid inspecting/modifying other SerializedObjects from within a live-property override callback.
  2. Defer nested property reads to after the current override callback returns.
  3. If you must read properties, use a non-cached path that does not go through Internal_HasLiveProperties.

Example fix

// before
// inside a live-property override callback:
var other = new SerializedObject(someTarget);
other.Update(); // re-enters live-property path -> throws

// after
// defer the work outside the callback:
EditorApplication.delayCall += () => {
    var other = new SerializedObject(someTarget);
    other.Update();
};
Defensive patterns

Strategy: try-catch

Validate before calling

// Not directly callable; guard by avoiding nested SerializedObject reads inside override callbacks.

Try / catch

try { /* property read inside callback */ }
catch (ArgumentException ex) when (ex.Message.Contains("Recursive"))
{ EditorApplication.delayCall += deferredWork; }

Prevention

When it happens

Trigger: A live property override callback triggers another property inspection that re-enters Internal_HasLiveProperties while s_CachedSerializedObject.m_NativeObjectPtr is still set. Native code calling back into the managed live-property path during an in-flight override.

Common situations: Custom PropertyDrawer/Inspector that modifies serialized objects from within a live-property override callback, causing recursion. Editor scripts reading SerializedObject properties inside a live update handler.

Related errors


AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13). Data as JSON: /api/errors/b744070ef796ed2f. Report an issue: GitHub.