I am developing a multiplayer game in Unity using the services of Google Play Game Services (GPGS), each of the players that connects gets a player id through GPGS is id is a string which I need to convert to whole and its elements add them to obtain a numerical value of each user and be able to perform a certain action.
The problem is not converting the string to int, it is already converted I can not perform any operation with them.
The code I have is the following:
//Declaración de variables
char[] caracter;
int[] valId;
//Inicialización de variables
caracter = nextParticipantId.ToCharArray();
valId = new int[]{0,0,0,0,0,0,0,0,0,0}
//Sección del código
foreach( char letter in caracter) {
Debug.Log("La letra es: " + letter);
Debug.Log("El valor de la letra es: " + Convert.ToInt32(letter));
valId[i] += Convert.ToInt32(letter);
}
The first Debug shows me the letter without problem, the second shows me its value without any problem too, the conflict is when I try to add the values of those letters.