Hello!
I am trying to get my sprite positioned correctly in bottom right corner of the screen using this code in Start(ortho camera):
float x,y,w,h;
x = Screen.width;
y = 0;
w = transform.localScale.x * GetComponent<SpriteRenderer>().sprite.texture.width;
h = transform.localScale.y * GetComponent<SpriteRenderer>().sprite.texture.height;
Vector2 pos = Camera.main.ScreenToWorldPoint(new Vector2(x - w/2, y+h/2 ));
transform.position = pos;
Unfortunately, instead of seeing my sprites right bottom corner exactly in the corner of the screen, it is at some distance from the corner (about 20 pixels), fully on screen.
What am i doing wrong?