Hey all,
Currently I’ve got a two lists for vector3’s and quaternions and I’m adding them to a list of these lists so I can keep record of object positions each time the function is called.
Everything seems to work largely as intended, except it seems that if I replace a list with a new set of data (after passing it into the list of lists), the original data that got added into the list of lists is also changed.
Is there a way of just adding the data from a list to another array type variable without having all the values reset?
<Vector3> pos = new List<Vector3>();
List<Quaternion> rot = new List<Quaternion>();
List<List<Vector3>> posArray = new List<List<Vector3>>();
List<List<Quaternion>> rotArray = new List<List<Quaternion>>();
void updateVariables()
{
pos.Clear();
rot.Clear();
for (int i = 0; i < boxes.Length; i++)
{
pos.Add(boxes*.transform.position);*
rot.Add(boxes*.transform.rotation);*
}
posArray.Add(pos);
rotArray.Add(rot);
}