In my game i need to re-size the character (which is a gameObject with a sprite renderer) to a specific size, which is excatly the 1/7 of the screen…
I use this code:
float ScaleIndex = 1f;
float CharSize = Player.renderer.bounds.size.x * 100; //Sprite Unit is set to 100
float PreferredSize = Screen.height / 7;
StaticStorage.ScaleIndex = PreferredSize / CharSize;
Player.transform.localScale = new Vector3(StaticStorage.ScaleIndex, StaticStorage.ScaleIndex);
My problem is, that the game resize the character to everything but the 1/7 ofthe screen…
Examples:
Unity editor:
Render Area: 15,4 Cm
Player Size: 1,3 Cm
15,4 / 1,3 = 11,8 (which is not even close to 7…)
External windows game window size (my monitor size in fullscreen)
Window size: 27,1 Cm
Player Size = 4,0 Cm
27,1 / 4,0 = 6,85 (Which is yes, pretty close to 7)
Tablet:
Screen size: 11,3 Cm (Statusbar not counted in, i don’t know if Unity count it or not, but that doesn’t matter with that diference)
Player Size: 1,2
11,3 / 1,2 = 9,41 (Which is again pretty far from 7)
And the most fun, my WT19i Android phone:
Screen size, without statusbar: 4,55 Cm
Player Size: 0,2 Cm
4,55 / 0,2 = 22.75 Cm (Whaaaaaaaaaaaat ???)
What is wrong with it ?
