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 Gameart1235 · Jul 22, 2014 at 05:19 PM · updatesaveloadsave file

Save and Load

I'm am trying to make a Save and Load system for my game.

I want it to work like this their are up to three slot you can save. In your Menu you can Load your game file.

[Slot 1]

[Slot 2]

[Slot 3]

Like a Rpg Game.

By the way I want the Save file to be save on to the computer. And How can I Make it so if I every update the game the player will keep their save file.

Plz Help.

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 Gameart1235 · Jul 23, 2014 at 04:38 AM -1
Share

I was thinking about the Save and load and has some more questions.

(1) How can you save Static Variables?

(2) What code do you need to save the game? and what do it save?

(3) How do Load a save file?

(4) Where do the file go on your computer?

(5) Save the Player Position and Object that been create like (Building, Loot, $$anonymous$$onsters that you kill)

avatar image calebheale Gameart1235 · Jul 23, 2014 at 04:45 AM 2
Share

You should watch the training video on data persistence. It answers literally every question you have listed here in a lot better detail than any of us can provide with just a written solution. The only question it doesn't describe explicitly is your question on static variables but they are handled the same way as any other variable as long as you have visibility to them. And I believe that once you understand the basics you will understand how to do static variables too.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by A3tra3rpi · Jul 22, 2014 at 06:34 PM

Take look at unity serializer http://u3d.as/content/ixion-software/save-game-json-binary/33x. it has same kind of saving slot system as you descriped. I'm not sure if serializer files can be untouched on updating your game. It depends on your updater.

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 zharik86 · Jul 22, 2014 at 06:33 PM

The most simple and fast way, it to use PlayerPrefs. And also look at PlayerPrefsX addition here according to this link:

  private Vector3 myPos = Vector3.zero;

  //Function of data loading using slot number
  public static void LoadDataFromSlot(int tpSl) {
   //See correct of slot how string Slot1_PlayerPosition and etc
   string nameSlot = "Slot" + tpSl.toString() + "_";
   //For example position of your character, how Vector3
   myPos = PlayerPrefsX.GetVector3 (nameSlot +"PlayerPosition", Vector3(100, 50, 0));
   ...
  }

  public static void SaveDataToSlot(int TpSl) {
   //See correct of slot how string Slot1_PlayerPosition and etc
   string nameSlot = "Slot" + tpSl.toString() + "_";
   //For example, save position
   PlayerPrefsX.SetVector3(nameSlot + "PlayerPosition", myPos);
   ...
  }

I hope it will help you.

Comment
Add comment · Show 2 · 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 Gameart1235 · Jul 23, 2014 at 04:34 AM 0
Share

How would you save all the static variables?

avatar image zharik86 · Jul 23, 2014 at 07:16 AM 0
Share

@epicking220 I would save as well as would load them, but wouldn't do variables static. It is better to make static functions of saving/loading. At the very beginning of development of use of PlayerPrefs the best. Further already, when everything is ready if to you not to be pleasant to PlayerPrefs, it is possible to write the script for loading/saving. I added the response.

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

23 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

Related Questions

Save and Load Questions 0 Answers

Saving/Load using menu C# 1 Answer

Loading a list into unity 0 Answers

PlayerPrefs 2 Answers

PlayerPrefs don't load again after Android game closes for the first time. 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