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
1
Question by Chesley · Dec 05, 2011 at 12:39 PM · scenesavingingame

Scene saving

can you save a scene in game, so that when the game is restarted people still have everything that was added or removed in the scene?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by TheCodeMonkey · Dec 05, 2011 at 02:31 PM

I am unsure if anything exists for this in unity itself. I believe it is up to you to save the "state" of everything in your scene if you wish to save that(something like buildings built, or what has been killed/completed so far) then depending on how your scene is structured when it starts it first checks for a valid savefile, and then builds itself accordingly. Although if that is the case it seems that you would have to build basically your entire scene to work with this system, things spawning/loading/appearing or not depending on what was in the save file information.

You should be able to use PlayerPrefs to get the job done:

http://unity3d.com/support/documentation/ScriptReference/PlayerPrefs.html

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 Statement · Dec 05, 2011 at 03:06 PM 0
Share

No, but there are third party plugins that serialize most of the scene. I don't know if Unity have fixed some issues with some variables not being public/usable for serialization... But at least in the past there have existed built in components that simply weren't loadable/savable, because you couldn't read or write some of the variables via code.

avatar image
1

Answer by Statement · Dec 05, 2011 at 03:10 PM

Check out Above and Beyond Softwares EZ Game Saver which seems to be a quick and easy route for handling savegames. The task of writing your own save game code can be a daunting task unless you're familiar with reflection.

Also, depending on your code design, you might have to rethink a lot of your existing code to work with savegames. Every single data value has to be accounted for if you want to make an exact replica of the game state. For advanced games, adding savegames late on can be a challange.

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 TheCodeMonkey · Dec 05, 2011 at 03:13 PM 0
Share

Ahh I was unaware of that, thanks for sharing. Although it does look like either way Chesley will have to rework his code to account for the fact that it is a save game.

avatar image
0

Answer by Ben-BearFish · Aug 24, 2014 at 04:47 AM

I know this is an old question, but for anyone new who sees this page, you should really look into Serialization/Deserialization. Especially using JSON. If you want an excellent plugin that does this for you, you should use this plugin:

http://forum.unity3d.com/threads/released-json-net-for-unity-3-5-with-aot-support.200336/

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

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

Save data from one scene to another? 0 Answers

How to create a complicated game over scenario ? HELP 0 Answers

Create and Name a new scene through the script. 1 Answer

in-game programming console(how to?) 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