

You open your project and Unity gets stuck on “Reloading Assemblies.” Or the Editor freezes when entering Play Mode. Sometimes the Inspector keeps refreshing endlessly. In worse cases, Unity crashes without a clear error message.
This is often described as the “Unity serialization loop bug.” While it feels like a Unity engine failure, it is usually caused by circular references, improper serialization patterns, or heavy object graphs that Unity cannot safely process.
This guide explains what causes serialization loops, why they lead to infinite loading or editor crashes, and how to fix them safely.
Serialization is how Unity saves and loads data. It converts object fields into a format that can be stored in scenes, prefabs, and assets.
Unity automatically serializes:
When Unity reloads scripts or enters Play Mode, it deserializes this data back into objects.
If something in this process forms a circular reference or unsupported structure, problems begin.
A serialization loop happens when two or more objects reference each other in a way that creates a circular chain.
Example:
[System.Serializable]
public class A
{
public B b;
}
[System.Serializable]
public class B
{
public A a;
}
This creates a circular reference. Unity’s serializer may struggle to process it correctly, especially if nested deeply.
This is the most common cause.
If two [Serializable] classes reference each other directly or indirectly, Unity may repeatedly attempt to serialize them.
Fix:
Example fix:
[System.NonSerialized] public A a;
Unity can serialize references to MonoBehaviours, but deep nested references can create unstable object graphs.
Better pattern:
Unity serializes fields, not properties. If you accidentally combine serialized fields with property logic that modifies data during deserialization, you may create recursive updates.
Avoid logic inside getters and setters that changes other serialized data.
If a ScriptableObject references itself directly or through another asset, Unity may repeatedly attempt to resolve the dependency.
Check your ScriptableObjects carefully for hidden circular asset references.
OnValidate runs in the Editor when values change. If OnValidate modifies serialized data repeatedly, it can cause infinite refresh loops.
Problem example:
void OnValidate()
{
someValue++;
}
This changes serialized data every time Unity validates, causing continuous reserialization.
Fix: Avoid modifying serialized data directly inside OnValidate without conditions.
Even without circular references, very deep nested lists and complex data structures can slow serialization dramatically.
Example risky pattern:
Break complex data into smaller independent assets when possible.
Steps to isolate the issue:
Binary search your code changes if necessary.
If the project crashes on load:
This forces Unity to rebuild the project cache.
True serialization engine bugs are rare. Most infinite loading issues are caused by problematic data structures or editor-time recursion.
Unity’s serializer is optimized for simple, predictable data layouts. Complex graphs and circular references push it beyond safe limits.
The Unity serialization loop bug usually happens because of circular references, recursive validation logic, or deeply nested serialized structures.
When Unity freezes during assembly reload or crashes entering Play Mode, always inspect your serialized data first.
Keeping data structures simple and avoiding circular dependencies will prevent most serialization-related crashes.