Hello,
I’m pretty new to Unity and I would like to know how can I fit something perfectly on a screen? I’ve googled a lot and have found different methods on the Camera class and the Screen.width and Screen.height properties, but the units differ quite a bit.
What I want to do is have a simple tile grid which can be displayed on any device correctly which means it should change based on screen size or the camera. That is the part that is bothering me.
I know how to mathematically get the correct calculations for distributing stuff, but Unity doesn’t use sizes on game objects, but it has a scale. Also, there is a big difference in units. By getting the screen size, I get the size in pixels. Those don’t mean a lot for placing my objects on the screen. If I get the coordinates from the camera viewport, I know how to position items into a grid, but I don’t know how to make objects (sprites in my case) get enlarged to fit into the desired grid size because I can’t set the object’s width and height. Instead, they have the scale which I don’t know how to manipulate to fit my needs.
I am guessing there is a simple solution to my problem, but I just got stuck and can’t seem to find an answer.
I would greatly appreciate any help!