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
0
Question by frarees · Mar 26, 2013 at 06:36 PM · c#serializationdictionaryhashtable

Serializing data structures the Unity way. Possible?

I want to serialize some custom classes and some C# types as Dictionary or Hashtable. Is there any way to write on top of Unity's custom serialization system? (e.g. overriding ISerializable)

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by whydoidoit · Mar 26, 2013 at 06:40 PM

Not that I've found. I serialize those types into Lists which will serialize OK and then build them back up in Awake or OnEnable. I also use my UnitySerializer to serialize custom objects to byte[] and then load them back in afterwards.

Comment
Add comment · Show 5 · 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 frarees · Mar 26, 2013 at 08:09 PM 0
Share

Such a pitty. How does Unity serialize List? Do we have access/documentation on this? (e.g. Inspecting the assembly, reflecting)

avatar image whydoidoit · Mar 26, 2013 at 08:11 PM 0
Share

I've no idea what that serialization is doing - I used to continually write Dictionary members and then remember that the didn't work when everything vanished. There's no doc I can find on the serialization stuff, you can dotPeek the source, but lots is in the C++ and we can't see that.

avatar image whydoidoit · Mar 26, 2013 at 08:13 PM 0
Share

It's not doing normal serialization - it's doing that SerializedObject, SerializedProperty thing. I'm sure someone though that was a good idea somewhere along the way :) They must have got stuck on the complexity of serializing references to other unity gameobjects and components held in collections - it's not easy, but it's perfectly doable.

avatar image frarees · Mar 26, 2013 at 08:42 PM 0
Share

I see. Here be dragons. Any announcement on Unity's roadmap to enhance the current serialization API to support custom advanced serialization? Or is just too complex to even think about it?

avatar image whydoidoit · Mar 26, 2013 at 08:44 PM 1
Share

Well I have a poll going for adding Level serialization including Dictionaries etc. It's doing all right. Link from here

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

11 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

Related Questions

Nested Dictionary data lost after playmode 0 Answers

In this case the lists do not serialize. Why? 2 Answers

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Combine Children Dictionary in place of Hashtable? 2 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