This question was
closed Apr 15, 2017 at 11:35 PM by
lyn-ith for the following reason:
The question is answered, right answer was accepted
Question by
lyn-ith · Apr 14, 2017 at 01:14 PM ·
objectscreen resolutionunitsrescale
how can i create an object that perfectly fits any screen size based on resolution
i want to create an object that takes screen.width and screen.height, converts them to unitys units and feeds it to the transform.localScale. i can't simply create a huge object, that fills every screen, because its size must match the screen. any idea on how i could make this work? is there a better way to do this?
Comment
Best Answer
Answer by lyn-ith · Apr 14, 2017 at 02:05 PM
i found a solution. (maybe there's a better one, let me know if you know one) i scaled the object to match screenSize in units, and scaled the orthographic CameraSize 5 * screen.height.
transform.localScale = new Vector3 (Screen.width, 0, Screen.height);
MainCamera.GetComponent ().orthographicSize = (Screen.height * 5);