Unity How to get screen resolution and convert units to screen pixels

Reso.cs
int w = Screen.width;
int h = Screen.height;
 
string str = string.Format("Screen res: {0}x{1}", w, h);

Use this code on the transfrom/object you want the x and y for.

Block.cs
Vector3 pos = Camera.main.WorldToScreenPoint (transform.position);
 
string str = string.Format("Block x: {0}, y: {1}", pos.x, pos.y);
Navigation
Print/export
Toolbox