Serialization depth limit 10 exceeded

Mark91

New member
Any ideas on how to fix this?

Serialization depth limit 10 exceeded at 'Opsive.UltimateInventorySystem.Core::DynamicItemDefinition.m_ItemDefinition'. There may be an object composition cycle in one or more of your serialized classes.

Serialization hierarchy:
11: Opsive.UltimateInventorySystem.Core::DynamicItemDefinition.m_ItemDefinition
10: AmmoData.m_ItemDefinition
9: Opsive.UltimateInventorySystem.Core.AttributeSystem::Attribute`1.m_OverrideValue
8: Opsive.UltimateInventorySystem.Core::AttributeBinding`1.m_Attribute
7: Opsive.UltimateInventorySystem.Core.AttributeSystem::Attribute`1.m_Binding
6: Opsive.UltimateInventorySystem.Core::AttributeBinding`1.m_Attribute
5: Opsive.UltimateInventorySystem.Core.AttributeSystem::Attribute`1.m_Binding
4: Opsive.UltimateInventorySystem.Core::AttributeBinding`1.m_Attribute
3: Opsive.UltimateInventorySystem.Core.AttributeSystem::Attribute`1.m_Binding
2: Opsive.UltimateInventorySystem.Core::AttributeBinding`1.m_Attribute
1: Opsive.UltimateInventorySystem.Core.AttributeSystem::Attribute`1.m_Binding
0: Opsive.UltimateInventorySystem.Core::AttributeBinding`1.m_Attribute
-1: ShootableWeaponAmmoBinding.m_AmmoDataAttributeBinding
 
interesting...

When are you getting this error? And on what object?
Does the error come with a error stack? That would be useful to know where it came from.

It seems like it is spending a lot of time in the Attribute Binding, which shouldn't be serializing anything. I will need to look into this in depth
 
Hello thank you for the reply. I actually made a new scene with default camera and light; I still got the error. I may start an entire new project and reimport; I will let you know if it get it again and what import caused it.
 
I created a new Unity Project, imported Ultimate Character Controller 2.3.2 (no issue), imported Ultimate Inventory System 1.1.6 (no Issue), and finally imported the Ultimate Inventory System Integration for the Ultimate Character Controller (the one on the UCC download page.) After I imported the integration package, I received this error. This package was downloaded 4/12/21. I imported the first two using Package Manager. I imported the integration by clicking the file in my computers download folder. Not sure if that last bit will help. The Scene is on the default scene and I am running Unity Version 2020.3.0f1 Personal <DX11>.
 
I have this same issue on multiple projects. Don't have much more info to share on it either expect both projects only have 1 item made each.
 
That's weird... I've never seen this particular issue.

After some research I can try guessing what is causing the issue. But the fact that it doesn't give more information doesn't help.
Could you try adding [NonSerialized] in front of the Attribute Binding field in Attribute script (the one in the Inventory system):

Code:
[System.NonSerialized] protected AttributeBinding<T> m_Binding;

While we're at it in the Attribute Binding script try adding [NonSerialized] to the Attribute field and the setter/getter. You can do so in both the AttributeBinding<T>

Code:
[NonSerialized] protected Attribute<T> m_Attribute;
[NonSerialized] protected Action<T> m_Setter;
[NonSerialized] protected Func<T> m_Getter;


and AttributeNameBinding class

Code:
[NonSerialized] protected AttributeBase m_Attribute;
[NonSerialized] protected Action<string> m_Setter;
[NonSerialized] protected Func<string> m_Getter;

Hopefully that breaks the infinite serialization loop.
 
I placed [NonSerialized] in Attribute.cs on the binding and the issue went away; I did not try the other two code suggestions. I will if you would like me too for some reason.

Code:
[NonSerialized] protected AttributeBinding<T> m_Binding;
 
That's great news, I'll make sure to keep that change for the next update, and I'll keep it in mind for future implementations
 
Top