Hello , I need to save a integer for each player , this integer must be able to be consulted and updated by the client.
I'm thinking of implement it in ScripData of each player.
How I can do in android?
I 'm right when implemented in ScripData or should I use NoSQL database.
THANKS
Best Answer
G
Greg Quinn
said
almost 6 years ago
1.) Add a runtime collection to the NoSQL database. You can call this collection something like customPlayerData.
2.) Add your integer field to this collection.
3.) Create an event that can be called from the client
4.) Create cloud code that queries the customPlayerData collection, you can use something like this...
var playerId = Spark.getPlayer().getPlayerId();
var playerCustomData = Spark.runtimeCollection("playerCustomData").find({"playerId":playerId});
Spark.setScriptData("playerCustomData", playerCustomData);
1.) Add a runtime collection to the NoSQL database. You can call this collection something like customPlayerData.
2.) Add your integer field to this collection.
3.) Create an event that can be called from the client
4.) Create cloud code that queries the customPlayerData collection, you can use something like this...
var playerId = Spark.getPlayer().getPlayerId();
var playerCustomData = Spark.runtimeCollection("playerCustomData").find({"playerId":playerId});
Spark.setScriptData("playerCustomData", playerCustomData);
i
ignacio gattei
said
almost 6 years ago
Thanks Greg!!!! but how I can do in android?
The code of client side to do a update in server ?
i
ignacio gattei
said
almost 6 years ago
Thanks Greg!!! but how I can do the consult and update in android code in the client side.?
G
Greg Quinn
said
almost 6 years ago
Hi Ignacio,
Are you using the Unity SDK? Or are you using the native Android Java SDK?
If you're using native Java sorry I don't know how to help, I would suggest creating a support ticket and ask them to help you with the code on that.
ignacio gattei
1.) Add a runtime collection to the NoSQL database. You can call this collection something like customPlayerData.
2.) Add your integer field to this collection.
3.) Create an event that can be called from the client
4.) Create cloud code that queries the customPlayerData collection, you can use something like this...
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstGreg Quinn
1.) Add a runtime collection to the NoSQL database. You can call this collection something like customPlayerData.
2.) Add your integer field to this collection.
3.) Create an event that can be called from the client
4.) Create cloud code that queries the customPlayerData collection, you can use something like this...
ignacio gattei
Thanks Greg!!!! but how I can do in android?
The code of client side to do a update in server ?
ignacio gattei
Thanks Greg!!! but how I can do the consult and update in android code in the client side.?
Greg Quinn
Hi Ignacio,
Are you using the Unity SDK? Or are you using the native Android Java SDK?
If you're using native Java sorry I don't know how to help, I would suggest creating a support ticket and ask them to help you with the code on that.
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2486 topics