- Home /
UI Camera Viewport Points
I'm messing with the Unity UI in 4.6 (usually a heavy NGUI user) and am having an issue trying to actually access some sort of camera component to calculate viewport points of positions in the UI.
I have a point somewhere in my UI that I want to convert to world space in a 3D camera. What I need to do is get the viewport point of that point relative to the UI 'camera'. I can't quite figure out how to access the UI Camera (which may not even exist I suppose). I have a Canvas--however the camera component of it is null. Perhaps the Canvas itself can calculate the viewport points. Moreover, I definitely can calculate them manually so to speak by just comparing the point against the extents of the canvas but I have a sinking suspicion this functionality is built in.
I don't really have any code to show yet--I simply am starting with a simple script to spawn something in my main camera from a point defined in the UI relative to the screen.
Your answer
![](https://koobas.hobune.stream/wayback/20220613174705im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to overlap cameras? 1 Answer
Translate GetWorldCorners (new UI) to Viewport for a camera rect 1 Answer
Data visualization in steamVR 0 Answers