Hello , so I’ve a loop that adds positions of objects to a string , it looks like this :
for (int n = 0; n < posicionesVector2.Length; n++)
{
for (int i = 0; i < posicionesVector2.Length; i++)
{
counter++;
posicionesVector2*.x = GameObject.Find("Quad" + counter).GetComponent<Bloque>().coordenada.x;*
posicionesVector2[n].y = GameObject.Find(“Quad” + counter).GetComponent().coordenada.y;
listaVectores.Add(GameObject.Find(“Quad” + counter).transform.position);
s += string.Format("{0}:{0} ", posicionesVector2*.x, posicionesVector2[n].y);*
PlayerPrefs.SetString(“PosicionsBloques”, s);
}
}
So later on on my “load game” loop I want to set the coordenada.x and coordenada.y with what’s stored in the string.
This line:
s += string.Format("{0}:{0} ", posicionesVector2*.x, posicionesVector2[n].y);*
Is storing the values correctly but when I want to load them they’re not correct.
I load them like this :
for (int z = 0; z < posBlocks.Length; z++)
{
for (int i = 0; i < posBlocks.Length; i++)
{
contar++;
GameObject objeto = GameObject.Find(“Quad” + contar);
objeto.transform.position = new Vector3(posicionX*.x, posicionX[z].y, 0);*
GameObject.Find(“Quad” + contar).GetComponent().coordenada = new Vector2Int(s*, s[z+1]);*
}
}
I dont know what I’m doing wrong.
Thank you!