void GetBackgroundsAndSetLastY()
{
backgrounds = GameObject.FindGameObjectsWithTag(“Background”);
lastY = backgrounds[0].transform.position.y;
for (int i = 1; i < backgrounds.Length; i++)
{
if (lastY > backgrounds*.transform.position.y)*
{
lastY = backgrounds*.transform.position.y;*
}
}
}
Because there is no gameobject with the tag “Background” in the scene. That will cause that the background array is empty and the line
lastY = backgrounds[0].transform.position.y;
will result in an index out of bounds exception.