Initial commit

This commit is contained in:
rudder
2026-08-12 14:03:44 +03:00
commit 9a7b4a57dc
304 changed files with 82311 additions and 0 deletions
@@ -0,0 +1,28 @@
using System;
using RudderSdk.Core.Abstractions;
namespace RudderSdk.Unity
{
internal class UnityDeviceIdProvider : IDeviceIdProvider
{
public string DeviceId => SystemInfoHelper.GetDeviceId();
}
internal static class SystemInfoHelper
{
private static string _cachedDeviceId;
public static string GetDeviceId()
{
if (_cachedDeviceId != null) return _cachedDeviceId;
_cachedDeviceId = UnityEngine.PlayerPrefs.GetString("rudder_device_id", null);
if (string.IsNullOrEmpty(_cachedDeviceId))
{
_cachedDeviceId = Guid.NewGuid().ToString("N");
UnityEngine.PlayerPrefs.SetString("rudder_device_id", _cachedDeviceId);
UnityEngine.PlayerPrefs.Save();
}
return _cachedDeviceId;
}
}
}