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
0
Question by xskyhorn_ · Dec 01, 2019 at 08:01 PM · automatic

how to autosave your game?

im making a mobile game for andriod and i want to make a autosave system. i made a save system before but that was when you press a but that it saves but not an autosaver. like when you press your home button that it saves your game and when you start it again you still have your progress you had before you closed your game.

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 Larry-Dietz · Dec 01, 2019 at 09:39 PM

If you already know how to save and load, then making the save occur when they exit the game is pretty easy.

There is a method that will be called when the the user tries to quit the game.

 void OnApplicationQuit()
 {
   //Call your save routine here
 }

This will run when the application is about to quit. Assuming that they quit the application, and don't just terminate it. To account for this, you could also call the save routine every couple of minutes, assuming your save routine runs quickly enough that the player wont notice it.

In the start method of a script in the game scene, you could check if a saved game exists and load it from there.

Hope this helps, -Larry

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 xskyhorn_ · Dec 02, 2019 at 06:20 PM 0
Share

ok thank you for the help imma try it rn

avatar image xskyhorn_ · Dec 02, 2019 at 07:49 PM 0
Share

okay it autosaves rn but now the only problem is the same with loading the game ive made a script to load the game but that was when you press the button load game its load the game but can you also make that when you start your game it autoloads the game? because i tryed "Void OnApplicationStart()" but then figured out that doesnt exist lol so can you also help me with that?

-patrick

avatar image Larry-Dietz xskyhorn_ · Dec 02, 2019 at 10:55 PM 0
Share

Call your load routine from the Start or Awake method on a script in the first scene that needs your game data.

avatar image xskyhorn_ Larry-Dietz · Dec 03, 2019 at 01:38 PM 0
Share

okay thank you i will try it again

avatar image KaspianR · Dec 03, 2019 at 01:51 PM 0
Share

Great answer! I would just like to point out that, for people who find this thread in the future, if the save function is too slow you can always run it asynchronously on a different thread although things that could change during the save should be saved synchronously at the end! There are a lot of great documentation on multithreading for anyone interested!

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

116 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 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 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 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 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 avatar image

Related Questions

Web Player Auto Update Failed 8 Answers

Is automatic lightmap atlasing broken in Unity 4.0? 4 Answers

Bad lighting in automated builds 0 Answers

How to assign auto target with tag in range?Help! 1 Answer

Why does Unity scale my 512 by 256 texture to a 512 512 on import? 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