I have a problem with server.UpdateUserReadOnlyData. It creates the following key/value pair:
The problem is that the key is "leaderboardname" but it should be the value of var leaderboardname.
For example, if the value of var leaderboardname = Leaderboardlevel1
Then, the key/value pair in UserReadOnlyData should be like this:
Leaderboardlevel1 1.5
What is wrong with my code? Why is the key not created correctly?
var currentlevel = args.Level; var leveldata = args.LevelData; var leaderboardname = "Leaderboardlevel" + currentlevel; var updatereadonlydata = UpdateReadOnlyData(leaderboardname, leveldata); function UpdateReadOnlyData(leaderboardname, leveldata) { var result = server.UpdateUserReadOnlyData({ PlayFabId: currentPlayerId, Data: { leaderboardname: leveldata }, Permission: UserDataPermission.Public }); if ((result != null) && (result.Error == null)) return true; else return false; }