Hello there! I have been trying to get a unique user device id using the code below:
ArrayList hardDriveDetails = new ArrayList();
class HardDrive
{
private string model = null;
private string type = null;
private string serialNo = null;
public string Model
{
get { return model; }
set { model = value; }
}
public string Type
{
get { return type; }
set { type = value; }
}
public string SerialNo
{
get { return serialNo; }
set { serialNo = value; }
}
}
public string GetDeviceUniqueIdentifier() {
ManagementObjectSearcher moSearcher = new ManagementObjectSearcher(“SELECT * FROM Win32_DiskDrive”);
string user_device_id = “”;
foreach (ManagementObject wmi_HD in moSearcher.Get())
{
HardDrive hd = new HardDrive(); //User Defined Class
hd.Model = wmi_HD[“Model”].ToString(); //Model Number
hd.Type = wmi_HD[“InterfaceType”].ToString(); //Interface Type
hd.SerialNo = wmi_HD[“SerialNumber”].ToString(); //Serial Number
hardDriveDetails.Add(hd);
user_device_id += (hd.Model + " | " + hd.Type + " | " + hd.SerialNo);
}
return user_device_id;
}
But I get the following error in Unity:
Assets\Scripts\RegisterUser.cs(6,14): error CS0234: The type or namespace name ‘Management’ does not exist in the namespace ‘System’ (are you missing an assembly reference?)
I tried to creatre a folder called Plugins and added a System.Management.dll file into it as was advised after google search. Also I tried to add a reference through Visual Studio C#, but in vain. I heard that option is kind of not supported is Mono. Is this true? How can I get user device info? I need it for unregisitred users to take into account their progress. Is there any other way to track it except using registration? Something like cookie in the web?