Map boundaries - GUI pixel to units
Hey,
I'm trying to understand 2D resolutions, but can't find good tutorial.
Currently I'm having problem with clamping player to camera, including sidebards. I have two GUI elements: - sidebar left 100px width; - sidebar right 200px width. My camera size is 5 units tall. I have no idea how to fix/clamp boundaries on X Axis. Need to clamp player between camera + sidebars width.
At res 1920x1080 - 1 unit should have 108 pixels height (1080/(5*2)) and 108*ratio (1.77) width. I guess Units are calculated dynamically based on current resolution?
Your answer
![](https://koobas.hobune.stream/wayback/20220612072808im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Need Help in understanding ScreenToWorldPoint 0 Answers
Changing resolution affect camera width but not height 0 Answers
Limit object movement inside donut 0 Answers
Make static object height match the max height of a bouncing ball in any resolution 0 Answers
Change font-size according to resolution 3 Answers