Skip to content

Commit

Permalink
fix: added object type for SetState
Browse files Browse the repository at this point in the history
  • Loading branch information
momintlh committed Jul 26, 2024
1 parent ac199b5 commit 00367c9
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion Assets/PlayroomKit/PlayroomKit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static void InsertCoin(InitOptions options = null, Action onLaunchCallBac
}
}



private static string SerializeInitOptions(InitOptions options)
{
Expand Down Expand Up @@ -435,6 +435,26 @@ public static void SetState(string key, float value, bool reliable = false)
}
}

public static void SetState(string key, object value, bool reliable = false)
{
if (IsRunningInBrowser())
{
string jsonString = JsonUtility.ToJson(value);
SetStateString(key, jsonString, reliable);
}
else
{
if (!isPlayRoomInitialized)
{
Debug.LogError("[Mock Mode] Playroom not initialized yet! Please call InsertCoin.");
}
else
{
MockSetState(key, value);
}
}
}

public static void SetState(string key, bool value, bool reliable = false)
{
if (IsRunningInBrowser())
Expand Down

0 comments on commit 00367c9

Please sign in to comment.