void Start()
{
var pos = new Vector2(Screen.width, Screen.height);
transform.position = Camera.main.ScreenToWorldPoint(pos);
}
I try to run this piece of code attached to a rectangular Hotbar of dimensions 384x96, I’m using this script to try and make it so that no matter the resolution of the screen used, the Hotbar will snap perfectly into the bottom right corner (starting out just making it snap to what you see then fine-tuning it into the right place.
The script has no compiler errors or warnings, but when I run it, no matter how I change the values of Pos, the Hotbar always snaps to show the top right corner of itself on the bottom left of the screen, with the rest off to the side/bottom.
Any ideas on how to fix this greatly appreciated. (I’m gonna try for a tiny bit more and then sleep on this post)