Quantcast
Channel: Questions in topic: "left"
Viewing all articles
Browse latest Browse all 135

How can I get the x position for the left(and right) of the screen?

$
0
0
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!

Viewing all articles
Browse latest Browse all 135

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>