Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
3
Question by orbobservation · Jun 08, 2014 at 05:37 PM · errorserialization

Serialization depth limit exceeded

Has anyone come across this since upgrading to 4.5?

Serialization depth limit exceeded at '::LogicStatements'. There may be an object composition cycle in one or more of your serialized classes.

I'm guessing it's one of those hiddden errors 4.3, et al. cleaned up for you.

The error is not stopping the build, just shows up constantly as an error in the editor.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Nikky_U · Jun 12, 2014 at 11:01 PM 0
Share

I'm getting the same error after my upgrade to 4.5 I am very interested in knowing what is causing it and if there is a workaround. I wonder if any of my (or your) assets may be causing it.

avatar image Pangamini · Mar 30, 2015 at 09:12 AM 0
Share

Hello. I am getting these error reports on classes that don't even derive from Unity class, nor they use the unity serialization... It's like unity picks random classes from my managed DLLs and prints this..

3 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by rutter · Jun 12, 2014 at 11:35 PM

Big forum thread about the issue, which includes discussion of the bug and suggested workarounds.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by turbanov · Nov 14, 2017 at 01:44 PM

When working with serialized objects (no matter engine or framework) you should always consider unfolding hierarchies into linear arrays (lists). It is enough for child elements to have an index for their parents (since references of non-behavior types are not serialized at all). You can then recreate the hierarchies in your OnEnable code. Just make sure, that both children arrays and possible links to parents are prefixed with [System.NonSerialized].

You should do so in Unity for one more reason. The engine doesn't seem to save information about types for properties past level 1, so you will have enums displayed as integers for child elements. be careful.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Bunny83 · Nov 14, 2017 at 02:08 PM 0
Share

Your first part is correct. However your last point about enums i can't reproduce. Can you actually create a case that reproduces this behaviour?

ps: The engine doesn't save any type information for custom serializable classes. That's the reason why it does not support polymorphism for such classes. "Fields" of a serialized class instance are always serialized based on the field type. The only exception are classes derived from UnityEngine.Object. Those are / need to be serialized on their own and Unity can actually serialize a "true" reference. In this case you can use polymorphism.

avatar image
0

Answer by morbidcamel · Feb 06, 2015 at 03:39 AM

Hi Guys,

I have a simple class which I use to build my game menu. This error never happened and sure I go about 4 levels down but I think there should be a way to control the "maxlevels" or something - also I can't see where recursion might occur from an editor's point of view

 [Serializable]
 public class GameMenuItem
 {    
     #region Menu Properties
     public string name;
     public string pauseMenuName;
     public MenuState state;
     public string key;
     public GameMenuItem[] subMenuItems;
 
     internal Vector2 position;
     internal int level;
     internal bool isSelected;
     [NonSerialized]
     internal object data;
     internal int selectedIndex = -1;
     #endregion
 }
 
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image mtsalenc · May 01, 2016 at 03:02 PM 0
Share

Did you figure this out?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

28 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

"Serialization depth limit exceeded" with non-serializable classes 1 Answer

UnityScript How To Deserialize? 1 Answer

Error Using DataContractSerializer 1 Answer

URGENT - Serializing error The type of argument is not primitive 0 Answers

How to serialize a gameobject using binaryformatter? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges