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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

deviceUniqueIdentifier on Windows can it change?

Discussion in 'Editor & General Support' started by MarxWright, Dec 17, 2015.

  1. MarxWright

    MarxWright

    Joined:
    Jun 3, 2015
    Posts:
    5
    I've starting using this ID to uniquely identify a number of Windows PC's (mostly 7) connected to our system.

    I know there where issues with the iOS version changing the ID whenever all apps for that vendor where removed.

    Do you know of any conditions where the ID would change on a windows machine (also possibly Linux Systems)?

    I wasn't worried before till I noticed that 2 machines may have changed their ID's is this something that could happy frequently?

    The documentation is not clear on this and I believe the expectation when you read the documentation is that this ID would be consistent for the device.

    Any clarification on this would be very helpful.
     
  2. MarxWright

    MarxWright

    Joined:
    Jun 3, 2015
    Posts:
    5
    It appears that it can change when the Windows product key changes at least.
     
  3. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,673
    Hey,

    I expanded the docs for Windows Standalone platform, will appear in future releases, here's a copy paste:

    On Windows Standalone System.deviceUniqueIdentifier returns a hash from the concatenation of strings taken from Computer System Hardware Classes (https://msdn.microsoft.com/en-us/library/windows/desktop/aa389273(v=vs.85).aspx):
    Win32_BaseBoard::SerialNumber
    Win32_BIOS::SerialNumber
    Win32_Processor::UniqueId
    Win32_DiskDrive::SerialNumber
    Win32_OperatingSystem::SerialNumber

    Sorry for the inconvience
     
    Cromfeli likes this.
  4. MarxWright

    MarxWright

    Joined:
    Jun 3, 2015
    Posts:
    5
    Thanks for the reply this has been very useful.

    I've done a quick bit of investigation and found something which could be undesired behavior.

    The Unique hash is made of of things which are not likely to change except for the Disk Drive serial number. It would appear you are using hash of all the drives currently connected to this system or at least the most recently connected drive. This includes portable USB drives.

    I tested the theory, adding a USB stick to the system then generating a Unique ID creates a different value than if the stick was not there. Removing the stick and trying again causes the previous Unique ID to be returned. While this doesn't necessarily void the function of the Unique ID it does made it possible to change this ID either accidentally or on purpose simply by adding or removing portable storage.

    Ideally this would not be the case and perhaps exclusion of portable storage would be a solution. For now at least we can advise accordingly.
     
    Cromfeli and ghostRecon101 like this.
  5. djkpA

    djkpA

    Joined:
    Mar 28, 2016
    Posts:
    14
    Hi MarxWright, I am also trying to use same hardware data to generate unique id and facing same issue with Win32_DiskDrive, did u find any solution?It would be helpful if u share the same with community here.
     
  6. Snorch

    Snorch

    Joined:
    Oct 19, 2017
    Posts:
    3
    Agh... I have the same issue...
     
  7. mikaelwallen

    mikaelwallen

    Joined:
    Jun 3, 2016
    Posts:
    56
    Tested this on Windows 10 (1803) with Unity 2018.4.5. To my relief the device ID did *not* change when I plugged in a USB stick. I guess this means this issue was resolved at some point.
     
  8. brad_werner_VB

    brad_werner_VB

    Joined:
    Nov 20, 2018
    Posts:
    4
    Has this issue with the device unique identifier changing on Windows machines been resolved?

    We're working with a security system that would love to use an immutable/unique device identifier to validate access requests on standalone builds.

    Running:
    Windows 10 and 11
    Unity version 2019.4.33f1