• 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 stick_penguin · Aug 21, 2013 at 11:53 AM · gameobjectsaveunity serializer

Help with serializing

So far I have installed unity serializer from the asset store, and set it up correctly, as the documentation says. What I want to do is save a gameobject , its children, and all their data, and be able to load it again later. I've looked around, but I can't seem to find any examples on how to do this. I've got the object to save, but i can't determine how to load it.

LevelSerializer.SaveObjectTree(gameObject);

LevelSerializer.LoadObjectTree(What do I put in here?);

I'm using unityscript for this. Thanks.

Comment
Add comment · Show 1
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 DocLogic · Jan 01, 2015 at 07:07 PM 0
Share

Can someone please provide an example for this problem? Im just not understanding it at all.

1 Reply

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

Answer by whydoidoit · Aug 21, 2013 at 11:55 AM

You use the return value of LevelSerializer.SaveObjectTree which is a byte[].

Comment
Add comment · Show 9 · 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 stick_penguin · Aug 21, 2013 at 11:58 AM 0
Share

Thank you, but could you please provide some sort of example code of the whole process? I'm completely new to serializing.

avatar image whydoidoit · Aug 21, 2013 at 11:58 AM 0
Share

You can also supply a function to be called when the operation is complete:

    LevelSerializer.LoadObjectTree(returnFromSaveObjectTree, function(loader) {
         Debug.Log(loader.rootObject.name); //Print the name of the root object loaded
    });
avatar image stick_penguin · Aug 21, 2013 at 12:05 PM 0
Share

Sorry for all the trouble, but I just want to see if I have this right. If I want to save my object, I write byte[] saveData = LevelSerializer.SaveObjectTree(this.gameObject);

when I load the object I write

 LevelSerializer.LoadObjectTree(saveData);
avatar image whydoidoit · Aug 21, 2013 at 12:05 PM 0
Share

There is some in the example scenes in the complete project and example code for writing save game functions.

You can look at TestSerialization for C# and Pause$$anonymous$$enu.js for Javascript.

avatar image stick_penguin · Aug 21, 2013 at 12:06 PM 0
Share

ok thanks for all your help

Show more comments

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

17 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

Related Questions

Unity Serializer: How do you save the children in a gameobject, when the game runs? 0 Answers

How can I save a gameobject's mesh? 1 Answer

Don't Load Collected items 1 Answer

save/load cloned game object 1 Answer

Save gameobject active 1 Answer


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