Sign In Register

How can we help you today?

Start a new topic

Get RuntimeCollection from Cloud to Unity

I'm trying to get a player database playerList in my runtime collection using the method in this tutorial (https://docs.gamesparks.com/getting-started/using-cloud-code/unity-cloud-code.html), to Unity. (I want to do a Listview with all the players later).

But i don't know how to get all players displayName for exemple...


here's what i got

new GameSparks.Api.Requests.LogEventRequest()

.SetEventKey("LOAD_PLAYER_DATA")
.Send((response) => {
if (!response.HasErrors) {
List<GSData> items = response.ScriptData.GetGSDataList("player_List");
foreach (GSData item in items) {
string username = item.GetString("displayName");
Debug.Log(username); }
} else
{ Debug.LogWarning("GSM| Error Fetching Balance /n " + response.Errors.JSON); }
});


1 Comment

It seems i had a problem getting playerID on a cloud code running in PlayerConnect , but it fixed. I can get my current player data :

GSData data = response.ScriptData.GetGSData("player_List");

print("Player ID: " + data.GetString("id")); print("Username: " + data.GetString("userName"));


But i want to get all players data so I can put them on a Listview (I'll have to get my hands dirty on this one :D )


I'll change my code and import leaderboards later, but for now i just want to know how to do it with the whole players mirrored database

Login to post a comment