How to get screen coordinate of plane

I have a plane(game object) where i want to display the score of player at the end of game. i want to know how can i get the plane screen coordinate. plane.position will give the position of center of plane i need to know the x,y coordinate of top left and bottom right so that i can display the score in between them using gui

Ex

GUI.Label(new Rect((plane x),(plane y), (plane width),(plane height)), "Best: "+score);

Also is there is any other way so that i can display my score that fits in plane.

I’m going to assume you are using a Quad for your ‘plane’ which has world size of 1.00. If you are using a Unity plane, the base size is 10.0. I’m assume the plane is parallel to the camera plane (it would be solved differently if the plane is at an angle)

var upperLeft = transform.position;
upperLeft.x -= 1;
upperLef.y += 1;
upperLeft = Camera.main.WorldToScreenPointPoint(upperLeft);
upperLeft = Screen.height - upperLeft;

var lowerRight = transform.position;
lowerRight.x += 1;
lowerRight.y -= 1;
lowerLeft = Camera.main.WorldToScreenPoint(lowerRight);
lowerRight = Screen.height - lowerRight;

If you are using a Unity plane, replace the ‘1s’ with ‘10s’. This can be done with fewer lines of code. I strung things out so you can see what is going on. And final the last line of each section…

    upperLeft = Screen.height - upperLeft;

…is necessary to convert Screen coordinates to GUI coordinates.