Unity-Technologies/UnityCsReference · error · ObjectDisposedException

BuiltinBakedReflectionSystem

Error message

BuiltinBakedReflectionSystem

What it means

Thrown by BuiltinBakedReflectionSystem.Tick() when the instance's 'disposed' flag is true. This is the standard ObjectDisposedException pattern: after Dispose has run (including via the finalizer), any further use of the object is rejected. Tick is the per-stage update entry point used by the reflection baking pipeline.

Source

Thrown at Editor/Mono/Camera/BuiltinBakedReflectionSystem.bindings.cs:49

        bool disposed { get { return m_Ptr == IntPtr.Zero; } }

        BuiltinBakedReflectionSystem()
        {
            m_Ptr = Internal_GetPtr();
        }

#pragma warning disable UA5000 // The Avoid Finalizer Analyzer produces compile errors for any new finalizers. This pre-existing finalizer declaration has been suppressed, but should be rewritten if possible.
        ~BuiltinBakedReflectionSystem()
        {
            Dispose(false);
        }
#pragma warning restore UA5000

        public void Tick(SceneStateHash dependencies, IScriptableBakedReflectionSystemStageNotifier handle)
        {
            if (disposed)
                throw new ObjectDisposedException("BuiltinBakedReflectionSystem");

            m_Handle = handle;
            Assert.IsNotNull(m_Handle);

            Internal_Tick(dependencies);
        }

        public void SynchronizeReflectionProbes()
        {
            if (disposed)
                throw new ObjectDisposedException("BuiltinBakedReflectionSystem");

            Internal_SynchronizeReflectionProbes();
        }

        public void Clear()
        {
            if (disposed)

View on GitHub (pinned to 225b0fbdb5)

Solutions

  1. Track disposal state alongside the reference and stop calling Tick after Dispose.
  2. Re-acquire the BuiltinBakedReflectionSystem instance from its owning system instead of reusing a stale reference.
  3. Null/disposed-check before invoking Tick (or wrap in try/catch for ObjectDisposedException).

Example fix

// before
system.Tick(deps, handle); // may throw if disposed

// after
if (!systemIsDisposed)
    system.Tick(deps, handle);
Defensive patterns

Strategy: validation

Validate before calling

if (!systemDisposed) system.Tick(deps, handle);

Try / catch

try { system.Tick(deps, handle); } catch (ObjectDisposedException) { /* re-acquire system */ }

Prevention

When it happens

Trigger: Calling Tick(dependencies, handle) on a BuiltinBakedReflectionSystem instance that was already disposed (Dispose(true/false) ran, setting disposed=true). Typically a stale reference retained after the baking system was torn down.

Common situations: Caching the reflection system reference across an editor state change that disposes it; using a reference captured before a domain reload; logic that does not clear its handle when Dispose is called.

Related errors


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