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 Chuckler · Dec 13, 2012 at 11:34 AM · scenesaveloadnamehighscore

How can i save/load a changing variable in a scene file?(EX:highscore/name)

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
0

Answer by BiG · Dec 13, 2012 at 11:53 AM

You could elaborate your question a little, just for giving more details about what you want. By the way, do you know about PlayerPrefs?

Comment
Add comment · Show 3 · 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 Chuckler · Dec 13, 2012 at 01:35 PM 0
Share

Sure, basically when the game is over, the highscores are displayed...with names and score...updated every time there is a better score...i would actually go with like a top 20 i think...

Somthing like this

  1. Chuckler 20000

  2. Other Dude 18250

  3. next guy 17500

  4. forth player 16000 etc... and no i don't yet know about player refs..! I be green :)

avatar image BiG · Dec 13, 2012 at 01:51 PM 0
Share

So, you could use an array of PlayerPrefs (http://wiki.unity3d.com/index.php/ArrayPrefs), with 20 entries (that are the 20 top scores).

At each "game over", you can compare the actual score (the score reached at the game over) with the last entry of the array: if the new score is greater than that, you have realized a new score that have to be registered in the highscores list.

At that point, you have to "scan" your array, finding the correct place for the new entry and updating the others. As an example, a new score of 18.000 points would be, regarding your example at the top, inserted at the 3° position.

I know that it's nothing more than a starting point, but it's a bit hard to give an exaustive answer without starting from some code. I recommend to investigate arrayPrefs a little (they are easy to understand...). Then, if you are already familiar with arrays, the things should be easy to implement.

avatar image Chuckler · Dec 13, 2012 at 02:05 PM 0
Share

Wicked dude, let me go check this out...ty

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

10 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

Related Questions

Anyway to save which seen the player was on, then load that scene back from another one at a different time? 2 Answers

How to save or load higher score with google play services 0 Answers

Highscore won't save 3 Answers

Saving and loading scene specific data - (safe for scene renaming) 1 Answer

Remembering the state of a scene 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