public class Main_Player : MonoBehaviour {
private Vector3 _place_player;
// Use this for initialization
void Start () {
_place_player.x = Screen.width * 0.1f;
_place_player.y = Screen.height * 0.5f;
_place_player.z = 0;
transform.position = Camera.main.ScreenToWorldPoint (_place_player);
print (transform.position);
It doesnt set the proper position on the screen (Screen,width * 0.1f) and Screen,height * 0.5f
It still uses screenpoint or something
You are not saying what kind of results you are getting.
The function itself does as explained in the documentation
My guess is that the problem is here _place_player.z = 0
. The object will be placed 0 units in front of the camera, so effectively on top of or above/below/next to the camera.
If you are using a perspective camera for example, anything in the view frustum that is 0 units in front of the camera is basically on top of (same position as) the camera and the other 2 values don’t even matter (because the view frustum is a pointy pyramid shape starting from the camera position)
Also depending on the pivot position, size and orientation of the object you are positioning, the results might look wrong although the calculated coordinates are mathematically correct.
If this is happening on a device and setting the z value to greater than 0 doesn’t help, i guess it could be possible that the Screen.width/height are being reported wrong