Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Andrew Cherkashin · Mar 30, 2010 at 11:34 AM · serverserializationjsonbinary

binary serialization in c#

I'm looing for solution how to serialize and de serialize binary data. I want to use BJON (Binary JSON), but i can change my decision, so i found that solution - http://james.newtonking.com/archive/2009/12/26/json-net-3-5-release-6-binary-json-bson-support.aspx . Is it works in unity or now? What you can recommend me for me?

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 Ricardo · Mar 30, 2010 at 01:29 PM 0
Share

If it requires 3.5, likely not yet. Why not try it?

avatar image kernys · Jul 09, 2013 at 08:01 AM 0
Share

Check it out $$anonymous$$ernys.Bson. I made it for Unity. API is simple and easy to use. ;)

https://github.com/kernys/$$anonymous$$ernys.Bson

4 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by SharedProphet · Aug 21, 2010 at 04:32 PM

Or if you are willing to decorate the objects you are serializing with attributes, and you're not serializing anything stored as just "object", you could try protobuf-net (Google Protocol Buffers). It is faster and serialized objects take up less space than using BinaryFormatter.

Comment
Add comment · Show 3 · 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 mindlube · Feb 24, 2011 at 04:27 PM 1
Share

protobuf-net is awesome! doesn't work on unity iOS though.

edit: protobuf-net v2 beta is out. I've been using it on iOS and works fantastic.

avatar image MrGuardianX · Sep 25, 2014 at 01:31 PM 0
Share

Unfortunately it is not easy to serialize built-in Unity3D types like GameObject, Transform, Component in protobuf-net. So one won't get away with just using attributes if he wants to serialize those (and it is usually the case when you want to store the part of the scene). Serializing components is yet another non-trivial tasks.

avatar image MidnightStudiosInc · Jul 01, 2015 at 03:38 PM 0
Share

GameObject Serializer Pro is built on top of protobuf-net, and includes many of the common surrogates need to serialize Components like Transform, and even entire GameObjects (This is not normally what you want unless you are creating procedural content).

Even if you are not creating procedural content, using the support for primitive types like Vector3 and Quaternion can save a lot of work.

avatar image
2

Answer by qJake · Mar 30, 2010 at 04:34 PM

You should look into the .NET-specific class BinaryFormatter (MSDN). It will binary-serialize any ISerializable object for you.

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
0

Answer by Zeanog · Dec 14, 2011 at 07:53 PM

Also if you want to serialize Unity objects you can try using ISerializationSurrogate

http://msdn.microsoft.com/en-us/library/system.runtime.serialization.iserializationsurrogate.aspx

I used it to serialize MonoBehaviours as they dont need to be created when you deserialize. You just serialize the name( or unique id ) of the game object that owns your MonoBehaviour script and then use GameObject.Find when you deserialize.

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
0

Answer by MidnightStudiosInc · Jul 01, 2015 at 03:36 PM

GameObject Serializer Pro is built on top of protobuf-net, and includes many of the common surrogates need to serialize Components like Transform, and even entire GameObjects (This is not normally what you want unless you are creating procedural content).

Even if you are not creating procedural content, using the support for primitive types like Vector3 and Quaternion can save a lot of work.

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 naavox · Oct 16, 2016 at 06:13 PM 0
Share

Does this package allow backwards compatible reading of save files? For example, with protobuf you'd serialize some object, and if you later change it's class definition, you can still deserialize old versions of it as long as you only added fields. This is essentially why I'm considering using protobufs, so that I won't make players' save files unreadable when I push updates. But figuring out how to get protobuf-net into my project - wow - looks like quite a pain, so I'm hoping I can just use your package.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

JSON - Load Subset of Files Based on Key in File 0 Answers

"Asset Serialization Mode" - Is that only during development or runtime as well? 1 Answer

Upload Save (Unity Serializer) to Server 1 Answer

How do I send data to a cloud server like Amazon EC2? 1 Answer

How to serialize a reference to a ScriptableObject asset file using the JsonSerializer 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