Answer the question
In order to leave comments, you need to log in
How to script the size of a square in Unity and place it relative to the upper left corner (android 2d)?
Hello. I've been rummaging through manuals all night, I'm already tired of it, to be honest. Here's the catch. So that always and at any screen resolution, the squares remain squares, as well as the indents between them - all this had to be calculated programmatically (the width of the square and the indents that depend on the width of the screen), that is, scripts. But I just can’t find a function to resize, and for some reason the location of the object is calculated using position from the bottom left corner.
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
As I understood from the last paragraph, we are talking about the GUI. OK.
Then you can change the binding to the corner of the screen by clicking on this button
. In general, look at RectTransform and use it in scripts, there is an opportunity to set the size. It's just too early for you to learn it, you haven't even learned Transform yet, since you couldn't use scale to change the size of your square.
Why do your squares at different resolutions become non-square - I have no idea, they should not change, your jamb is most likely.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question