I don’t understand why am I getting the NullReferenceException error although I have already assigned a gameobject.
public class PositionSavers : MonoBehaviour
{
public GameObject tracked;
private static int n = 0;
private static Vector3[] objectPositions = null;
private void Start()
{
}
private void Update()
{
if(n < 500)
{
objectPositions[n] = tracked.transform.position;
n++;
}
if(n == 500)
{
Save(objectPositions);
n++;
}
}
}

![]()