Search Unity

Value from SystemInfo.deviceUniqueIdentifier Changed from 5.5.1f1 to 5.6.1f1

Discussion in 'Windows' started by oneuppedgames, Jun 30, 2017.

  1. oneuppedgames

    oneuppedgames

    Joined:
    Jul 30, 2013
    Posts:
    15
    Hi all.

    It's seems that the value I receive from using SystemInfo.deviceUniqueIdentifier changed after upgrading to Unity 5.6.1f1 to Unity 5.5.1f1. I've searched the forums and found some (old and new) topics on the same issue concerning Android (see: https://forum.unity3d.com/threads/unique-identifier-details.353256/).

    However this fix doesn't work under Windows.

    My question is: can I revert to the old way (I can't go back to 5.5 though).
    Also: Is there a way to read out the default Windows UUID (for instance: wmic csproduct get "UUID" in CMD).

    Cheers!
     
  2. oneuppedgames

    oneuppedgames

    Joined:
    Jul 30, 2013
    Posts:
    15
    For those wondering how to read out the Windows UUID through the registry. This code looks for the UUID in the HKEY_LOCAL_MACHINE / SYSTEM / HardwareConfig / LastConfig, which provides the same value as wmic csproduct get "UUID"

    Code (csharp):
    1. using Microsoft.Win32;
    2. using System;
    3.  
    4. private string GetWindowsUUID()
    5.     {
    6.         string UUID = "";
    7.         try
    8.         {
    9.             using (RegistryKey key = Registry.LocalMachine.OpenSubKey("SYSTEM\\HardwareConfig"))
    10.             {
    11.                 if (key != null)
    12.                 {
    13.                     System.Object o = key.GetValue("LastConfig");
    14.  
    15.                     string tempUUID = o as string;
    16.                     UUID = tempUUID.Replace("{", "").Replace("}", "").ToUpper();
    17.                 }
    18.             }
    19.         } catch (Exception ex)
    20.         {
    21.              Debug.LogError("foo"); // or throw error
    22.         }
    23.         return UUID;
    24.     }
    25. }
    26.