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 BramNH · Oct 17, 2015 at 07:16 PM · android2d gameplayerprefsstorecoins

Saving coins

Hello,

I am making a android 2d catch game where you have to catch falling objects. Now when you catch one, you'll get one point. What I want now, is that when you are out of lifes, that on the menu is displayed your total of coins. So if you start again, catch some objects and then die again, the coints are added to your total coins. And when you close the app, that it is all stored. I think this is possible with playerprefs but don't know how to do this all.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by PictonicStudio · Oct 17, 2015 at 07:24 PM

Yes, using player prefs would be correct.

 //Write
 PlayerPrefs.SetInt("Coins", 1);
 //Read
 int Coins = PlayerPrefs.GetInt("Coins");
 

http://docs.unity3d.com/ScriptReference/PlayerPrefs.html

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 felixfors · Oct 18, 2015 at 09:10 AM

You basicly asking us to make the game for you, this is not a question about a certain problem but you asking us to make the game for you. Make a main script that has the coins value stored. you should look into Sendmessage and OnCollisionEnter functions, do so try it out post your script and than we can help you atleast thats when I will help you.

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 BramNH · Oct 18, 2015 at 10:42 AM 0
Share

No, I am asking you for help or some information about playerprefs with adding coins. A system which adds the caught bottles to the coins. I don't know why you see the whole game in there but okay. And I was not able to send a script, because I didn't have anything yet. Now with this information I can start, so thank you for your answer.

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

How to save data without using PlayerPrefs? 2 Answers

Unity 2d game Does NOT work with these devices: Samsung Galaxy Grand - Galaxy j1 - Galaxy Grand prime 0 Answers

Sync PlayerPrefs Between Phone and Android Wear 2 Answers

Save downloaded content when App is updated 0 Answers

Sprite not Rendering when animating in z-axis in a 2d Game 3 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