I am trying to make a cube that doing one step equals to 1/4 of Screen.width (step right or left).
But when i am changing resolution this step is more or less then 1/4 of Sceen.width. So how can i make step of 2D Square is always be 1/4 or 1/9 of screensise. And won’t be changed after changing res. of the screen.
I know this is very stupid question, thanks for answers
Unfortunately this is somewhat difficult and will require some realtime calculations to adjust the camera.
Basically, unity scales the coordinate system to fit exactly into the HEIGHT of the display (actually the height of the camera rect)… so if the resolution changes, the top and bottom of whatever the camera can see always matches the top and bottom of the screen (unless you changed the camera rect). So if you switch resolutions and if they aren’t an exact multiple of the one you had before, or if you’re going from portrait to landscape etc, it’s going to automatically adjust the width ie how much of the scene is seen horizontally. So vertical is fixed, horizontal is flexible.
So if you want to have it seem like the horizontal dimension is exactly fixed, ie always showing a certain object 1/4 width of the resolution, then you will need to calculate what the height would be for that given width based on the aspect ratio of the resolution.
So i need to make a list of conditions that based on the res of the screen?
But is there abother simple way to make a step always the same not metter what resolution are.
For example i show u this grid. So based on it. I need to move this green square, step must equales this black squares.
Well you can just move the green square object one ‘step’ to the right for example, which is the width of the square. Whatever your coordinate system is it doesn’t matter, whatever size the square is, add that to the coordinate to move it one square over. Or subtract it.
I thought the issue you were having was more to do with making sure that all of the squares fill the full width of the screen if possible
Thanks for your hit, I understand that count of utins u go when using transform.position.x or y doesnt depends on what resolution does mobile device have. U are moving always on the same x.units whatever res are.