Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Yes:MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object. When I click on the error it brings me to the line where I say Instantiate...terrain.transform.rotation
Thanks fixed it but when the player is at the end of the first tile, it deletes that tile and spawns another(just like it should) but when the player is at the end of the second tile it doesn't spawn another tile and doesn't delete the second tile.
Ok but when I do this : objs.Add(terrain); then it instantly deletes terrain after launching the game. I think it's because of if (player.transform.position.z - safeZone >= (position.z - objs.Count * tileLength))