Screen Size
Hi, I'm creating a game as a learning experience just like a "flappy bird". Everything worked fine so far, but on a larger phone the screen is distorted. I think I should learn to use canvas, but I'm Brazilian and it's difficult to find a tutorial explaining canvas. I thought about using a command that I'll leave here, expand the objects according to their proportion, but I do not know if that's a good idea. I need tips.
Command:
public float a;
public float b;
public float posW;
public float posH;
void Start () {
a = transform.localScale.x;
b = transform.localScale.y;
}
void Update () {
posW = Screen.width;
posH = Screen.height;
transform.localScale = new Vector3(( a*posW/posH ), transform.localScale.y, transform.localScale.z);
}
Comment
Your answer
Follow this Question
Related Questions
Mesh not being rendered in build 0 Answers
How can I change one canvas image to another? 1 Answer
Activating multiple images under one canvas via multiple objects 0 Answers
2d unity game Camera issue 0 Answers
Can't delete RectTransform in Child 0 Answers