Skip to content

Commit 0d34e9c

Browse files
committed
Revert "Removed guid from ClientPrefs"
This reverts commit 3d9ebfa.
1 parent 6f27732 commit 0d34e9c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Assets/BossRoom/Scripts/Shared/ClientPrefs.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,23 @@ public static void SetMusicVolume(float volume)
3232
PlayerPrefs.SetFloat("MusicVolume", volume);
3333
}
3434

35+
/// <summary>
36+
/// Either loads a Guid string from Unity preferences, or creates one and checkpoints it, then returns it.
37+
/// </summary>
38+
/// <returns>The Guid that uniquely identifies this client install, in string form. </returns>
39+
public static string GetGuid()
40+
{
41+
if (PlayerPrefs.HasKey("client_guid"))
42+
{
43+
return PlayerPrefs.GetString("client_guid");
44+
}
45+
46+
var guid = System.Guid.NewGuid();
47+
var guidString = guid.ToString();
48+
49+
PlayerPrefs.SetString("client_guid", guidString);
50+
return guidString;
51+
}
52+
3553
}
3654
}

0 commit comments

Comments
 (0)