3D to 2D Point

Hello All!

I am trying to make a login page, and I have a slight twist to it. I need to get the position of a gameobject in 3D space, figure out what is that in the current viewpoint in 2D.

The best way I can describe it would be if I had a 3d mesh of a billboard in the scene. On the billboard, I have on the texture that has the names “Login” and “Password”. I need to use OnGUI to match the same locations on the texture but the issue is, people can resize the window browser and therefore the billboard positions is no longer in the static place.

My goal was to make empty GameObjects on the corners of the texture login and hopefully read their 2D positions and make the OnGUI put the label there.

Hope this makes sense. I can make a screenshot if someone is confused.

Thanks for the help!

You can use Camera.WorldToScreenPoint for this. I would recommend following your plan of using GameObjects as marker points for the text fields since it sounds like the easiest way to go.

You… are a life saver! Thanks!