I made my first game in Unity. It should be published to Android and iOS. Everything is working fine except the asteroids are cut off when I change the screen ratio to 9:18(Samsung S8, Lg G6...) The asteroids are being cut off because the spawn points are fixed to -2.4f to 2.4f. I tried various things but nothing worked...I was already told to use screen.width and then to make some logic but I have no idea how to make the logic so that it actually works. enter image description here
Here is my code that is spawning the asteroid in scene: Instantiate(asteroid1prefab, new Vector3(Random.Range(-2.4f, 2.4f), 6, 0), Quaternion.identity);
Any kind of help would be appreciated thank you