Scene placement

Hi,

I’m pretty new to working with Unity though I have been programming for a long time but there’s 1 aspect of the Unity editor that I can’t seem to figure out

Say I set-up my project to be for a specific device such as a phone, then the camera shows me the viewport. For arguments sake, say I then wanted to “box in” the middle of the screen by having walls all around the edge of the device, I have to create my assets add them to the scene then keep switching back and forth to the camera to ensure my positioning is correct.

Is there anyway I can always see the maincamera viewport without having to select it so that I can place my objects in relation to it? Or do I just need to brush up on my knowledge of the camera and scales to manually enter the positions based on the relevant math?

Thanks

You would do that programmatically, not manually, since there are a bunch of different resolutions/aspect ratios and trying to manually design for each one is not a great idea.

–Eric

Yup, as Eric said. Pull out a piece of paper and get cracking on ratios math! After you start doing, it’s quite easy, actually. Use Screen.width and Screen.height, and divide/multiply/add/subtract however you need.

However, if you’re talking about actual objects in the Scene (in contrast with objects in the GUI layer), then this will be much harder. You’d have to throw in raycasts and vector math as well.

Thanks for replies. Are there any good tutorials/articles purely focused on this that you could point me to?