Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question The User's Device Unique Identifier can change?? Really?

Discussion in 'Scripting' started by Sparticus, Nov 23, 2022.

  1. Sparticus

    Sparticus

    Joined:
    Mar 15, 2014
    Posts:
    149
    Hey all,

    I just published my first game on apple/android. I have a friend with an iphone that install the game. I use the device's Unique Identifier to basically make them an account in the database. So, as long as they play on the same device, I know who they are.

    https://docs.unity3d.com/ScriptReference/SystemInfo-deviceUniqueIdentifier.html

    However, my friend then un-installed the game, then re-installed it... he provided me a different Unique Identifier.

    How is this possible? Shouldn't it be the same always as it's the same device?
     
  2. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,064
    Don't rely on the
    deviceUniqueIdentifier
    . If they change devices they would lose their 'account' as well.
    On Windows even worse, have a new CPU or move it to an other disk and bam. Gone.
    Yes it may be unique but nowhere does it say that it is consistent throughout use.
    It even says so in the documentation that IDs will be different on Android with whatever signing key is used.

    Unity did create a new package for these kinds of authentications.
    https://docs.unity.com/authentication/IntroUnityAuthentication.html
    Perhaps you could give that a try. Or find other ways to get a unique but consistent identifier.
     
    Last edited: Nov 23, 2022
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,954
    Privacy laws stemming from rampant abuse of data collection to invade privacy. It definitely did NOT use to change on iOS / Android, and those days are long behind us.
     
    lordofduct likes this.
  4. Sparticus

    Sparticus

    Joined:
    Mar 15, 2014
    Posts:
    149
    Ok, thanks for the info guys. I'll check out that unity package mentioned above. :)
     
  5. kayaberkay

    kayaberkay

    Joined:
    Aug 10, 2022
    Posts:
    4
    Have you found a solution on UnityAuthentication? Anonymous player id changes on every update.