I have a scenario where I am iterating through gameObjects and storing their locations and rotations in arrays like this:
for(var base in bases){
if(base.name == "type1"){
baseLocations1.push(base.transform.position);
baseRotations1.push(base.transform.rotation);
}
if(base.name == "type2"){
baseLocations2.push(base.transform.position);
baseRotations2.push(base.transform.rotation);
}
}
The issue I am seeing is that rotations are all stored as (0,0,0,1)…however, if those rotations are read into a builtin array like this:
gameManager.baseLocations1 = baseLocations1.ToBuiltin(Vector3);
gameManager.baseRotations1 = baseRotations1.ToBuiltin(Quaternion);
gameManager.baseLocations2 = baseLocations2.ToBuiltin(Vector3);
gameManager.baseRotations2 = baseRotations2.ToBuiltin(Quaternion);
then the rotations are stored correctly.
Can anyone tell me why I’m seeing this? I am trying to upload the Arrays as joined strings (using Array.join), then ultimately pull them down somewhere else and use them to place objects on a map. The upload/download works perfect, it’s just that the format of the rotations is somehow getting zeroed out.