I have this code that is supposed to keep track of the locations and rotation of a gameobject in
public List<Record> Records = new List<Record>();
void Record () { //the Record function is call from FixedUpdate
CurrentRecord.pos = new Vector3 (0, 0, 0);
CurrentRecord.rot = new Vector3 (0, 0, 0);
CurrentRecord.pos = gameObject.transform.localPosition;
CurrentRecord.rot = gameObject.transform.localRotation.eulerAngles;
Records.Add(CurrentRecord);
}
I also made this code to help me debug some problems:
void Update () {
if (Input.GetKeyDown(KeyCode.R) ) {
for (int i = 0; i < Records.Count; i++) {
Debug.LogError (i + ". pos:" + Records [i].pos);
Debug.LogError (i + ". rot:" + Records [i].rot);
}
}
}
From these results I can see that all the list items are being filled with the same vector 3. I need help to see what is happening.