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 /
  • Help Room /
avatar image
0
Question by Game-Enthusiast · Apr 10, 2017 at 02:00 PM · loadsave game

Android Games Save/Load

I'm developing my android game is there a way how to save and load a game, current position of the player and coins count i'm using Complete Physics Platformer Kit and Mad Level Manager or anyone knows how to do it? like when you press the save button it will save player current position and coin count etc..and if you will exit the game and if you will press load button the game will load

THANKS IN ADVANCE

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 SohailBukhari · Apr 10, 2017 at 02:06 PM 0
Share

You can save game state using the PlayerPrefs ,Save Game State in the Scriptable Object or Use server.

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by JustinEllis · Apr 10, 2017 at 05:05 PM

Check this out: http://stackoverflow.com/questions/25746380/saving-loading-unity3d

This is the method I use and it works great. Only time problems arise is when you try loading a file when you have saved different information on it. For example saving mana points. Then later you decide not to use mana and try adding something else to save. When you load that on android it messes everything up. A fix is use a different file name.

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 Cuttlas-U · Apr 10, 2017 at 05:15 PM

Hi; saving for games is like pressing a button but for us who create the games is not easy like that ;

u should save each variable and load them ;

for example if u want to save the coin amount u should do it like this :

     public int coinAmount;
 
 
 // call this where ever u want to save the coin variable
  PlayerPrefs.SetInt("CoinNumber", coinAmount);


then when u want to get it in the next lunch of the game u should do it like this :

    void Start()
     {
         if ( PlayerPrefs.HasKey ("CoinNumber"))  // check if we already save It before
         {
 
             coinAmount = PlayerPrefs.GetInt("CoinNumber");
 
         }
 
         else
         {
 
             coinAmount = 0;
         }
 
     }


u should save all of your variables like this and load them again ;

i suggest u to watch some youtube tutorial just search "PlayerPrefs in unity" there are very good tutorial on who to do this ;

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

101 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

Related Questions

WebGl taking too long to load. size is large 1 Answer

Unity UI Dropdown options from folder 2 Answers

unity load in unity. Is it Possible ? 0 Answers

Problem: I am in multi display and after a load the device 2 and 3 does not work.,Problem: I am in multi display and after a load the device 2 and 3 does not work 0 Answers

2D player sliding after scene transition 0 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