Unity uses several different coordinate systems at the same time, as follows:
Also named Screen point system. The screen coordinates are defined in pixels. The lower left corner of the screen is the start (0, 0) point, and the upper right corner is the (Screen.width, Screen.height) point. As shown below:
This Coordinate system is used in the game play. When mouse click or finger tap, Unity will give out this kind of coordinate in the format of (x, y). So we have to use the method
ScreenToWorldPoint to convert to
World Space system.
When drawing GUI on the screen, such as popup dialog window. Unity will use a new coordinate system. The difference is that the coordinate system uses the upper left corner of the screen as (0, 0) point and the lower right corner as (Screen.width, Screen.height).
Also named World point system. This the main system used in the game. When adding game objects (such as Cube) to the scene/hierarchy, and they are all displayed in the scene in world coordinates.We can get a game object's position by calling
The viewport coordinates are relative to the camera. The lower left corner of the camera is the (0, 0) point, and the upper right corner is the (1, 1) point. The position of Z is measured in the world unit of the camera.
Join the newsletter to receive the latest updates in your inbox.