ViewportToScreenPoint doesn't work?

I’m getting crazy, Camera.mainCamera.ViewportToScreenPoint doesn’t seems to work for me…

I’m calling this function on a GUITexture passing transform.position as parameter and on 1,1 it will give me the position on the screen (857,310) instead of (480, 320) that I would expect…

do this function work on the iphone?

any thoughts?

I could write my own function but I would just like to understand why it’is not working…

The function works perfectly on the iPhone. In the editor, is your game’s aspect set to “iPhone Wide?”

Then your game view must be set to 857x310? Because that’s the only way you’d get that result in the editor.

–Eric

As mentioned above, but potentially not in as much detail, above your game screen is a drop down of various sizes. iPhone Wide will limit it to be a 480x320 screen, there’s also tall, etc.

yes I’m using the iPhone Wide setting and I haven’t touched any options at all… where can i find something like the resolution option?

thank you

iPhone wide is locked to 480x320, with large black borders.

With the exception of iPhone Tall, all other ones are resolution independent and will just scale to whatever the size of your game screen is.

ok, I’ve just found out where I was wrong…

I was calling the camera function inside the OnDrawGizmos so it was using the editor camera instead of the game camera (i was trying to draw some 2d line in the game view without luck…)

thanks everyone