Hi,
I am writing a simple spawn mechanic for a game and need objects to be able to spawn at random points between the top of the screen and bottom of the screen.
However, when using the below code to define the bottom of the screen it returns a coordinate which is in the center of the screen rather than the very bottom (hence making my current fix dividing it by 2).
var fieldstart = Camera.main.ScreenToWorldPoint(Vector3(0, 0, 0)).y;
To make matters even weirder the same script contains the below code, which sets the ship object to Screen.height/2, which again places it at the center of the screen (as it should do).
Instantiate(ship,Camera.main.ScreenToWorldPoint(Vector3(170,Screen.height/2, Camera.main.nearClipPlane+25)),Quaternion(0,-180,0,0));
The code does not reset the position of the spawning objects at any point of the code, nor does any other script.