In Unity, I am making a game where spheres spawn at a random position. I want the spheres can spawn a little outside the screen. This is the code where the spheres spawn:
`Instantiate (sphere_prefab, new Vector3 (Random.Range (-7, 7), 10, 0), Quaternion.identity);`
On a mobile it works great and the cubes can spawn (half)outside the screen, but on my pc, the spheres will not spawn outside the screen cause the screen is bigger so I want to know the left position of the screen so the code can be like this
`Instantiate (sphere_prefab, new Vector3 (Random.Range (screenLeft-2, screenRight+3), 10, 0), Quaternion.identity);`
Sorry for my bad English.
Thanks in advance!
↧