This might seems like a beginner question Apreciating any kind of solution,
im emiting this event from the server and give the obj a value, this is my client side
private void OnStart(SocketIOEvent obj){
if (obj != null) {
JSONObject json = obj.data;
id = json ["id"].str;
indexPlayer = Convert.ToInt32(json ["num"].str);
currentPlayer.GetComponent<Player>().AddPlayer (id, indexPlayer);
Debug.Log(json);
} else {
Debug.Log ("NULL Data");
}
}
the result of debug would be like this
{"id":"rJAkjUv5f","num":"1"}
this is because i convert all my integer to string before pass it to client
it's working but the matter is when i need to shuffle an array of index from the server to client, i try some way to convert an array of int to string but its not working. Began to wondering how to get int from a JSON object
let say this is my json data,
{"collection":[1]}
how do i get it?
Im using Unity with Nodejs server and Socket IO.