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 SubatomicHero · May 14, 2013 at 12:18 PM · c#highscoreid

Unique Highscore identifier

Hi all,

I currently have a script that posts a score to an online highscore system passing over the players name and players score. The problem I have is that if two people with the same name submit a score, the higher score will always be taken rather than having two separate scores.

Is there a way to get some form of unique ID per potential player that persists or is generated identically each time they start the game?

For example I play my game on Monday, my ID is 1334.

My highscore then shows:

ID 1334 Martin 10,000

Another guy called Martin plays 5 minutes later on a different machine and scores 9000 so the highscore looks like this:

ID 1334 Martin 10,000 ID Martin 9,000

EDIT: I've got a feeling this may involve writing to some form of config file, but any other ideas would be grand :D

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
2
Best Answer

Answer by Graham-Dunnett · May 14, 2013 at 01:59 PM

Use:

http://docs.unity3d.com/Documentation/ScriptReference/SystemInfo-deviceUniqueIdentifier.html

to get a unique id for the machine where the player is running on. Then submit this, and the player's name to the server. The server then looks up these in the database, and returns the id (1334) in your example. If this pair is not found, then create a new id and add this to your database. Return the new id. Now you have an id, so submit the high score.

However, I think the way that all games work is to avoid two people using the same name. The first Martin to submit a score gets to use that name. The second Martin needs to come up with a new name.

Note that all this stuff is more about databases and PHP or server-side script code rather than Unity.

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 SubatomicHero · May 14, 2013 at 02:01 PM 0
Share

Thanks Graham!

avatar image SubatomicHero · May 14, 2013 at 02:02 PM 0
Share

Does the ID remain the same each time the game is played?

avatar image DavidDebnar · May 14, 2013 at 02:11 PM 0
Share

Yes, it's unique for each device, but always the same for 1 device.

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

15 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

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

I need some help with my high score.,I need help with my highsore. 1 Answer

How do I save the high score from the game scene onto the main menu scene using PlayerPrefs and Dontdestroyonload? 3 Answers

High score system with timer? 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