So I have been watching a YouTuber named Press Start and he made a video called ‘Spawning Objects in Unity [Using Instantiate]’ and in that video, he explains that you need to spawn objects from left to right but the thing is, is that I’m making a different game where things would come from the bottom of the screen to the top of the screen and disappears once it leaves the screen and there’s another problem when there are 2 of that same errors saying ‘NullReferenceException: Object reference not set to an instance of an object’ (you also need to know that I’m dealing with 2 scripts here) how can I spawn objects from bottom to the top the screen and how can I fix the 2 errors that are appearing in the Console.
Unity Version: 2019.3.5f1
and the error is leading me to this line
screenBounds = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, Camera.main.transform.position.z));
Thank you for your time