Hi.
I’m trying to spawn gameobject and the X needs to be a random number BUT between the Screen left side and right side:
Vector3 final = Camera.main.ViewportToWorldPoint (new Vector3 (Random.value, 1, 10));
Instantiate(cube,final,Quaternion.Euler(0, 180, 0));
It works great but what if the game object spawns too left or too right?
In that situation half of the object is visible and the other half you cant see it because its out of the range…
any suggestions?