Version: Unity 6.3 LTS (6000.3)
LanguageEnglish
  • C#

HandleUtility.WorldToGUIPoint

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static Vector2 WorldToGUIPoint(Vector3 world);

Parameters

Parameter Description
world Point in world space.

Returns

Vector2 A Vector2 where the x and y values are the 2D GUI position of the world space point.

Description

Convert a world space point to a 2D GUI position.

Uses the current camera to calculate the projection. Use this to place Editor GUI elements based on world positions.

If the world point is outside the camera's frustum, WorldToGUIPoint returns x/y coordinates that might be outside the SceneView’s pixel rect.

WorldToGUIPoint discards depth information. To also get the view-space depth of the point, use WorldToGUIPointWithDepth, which returns the depth in the z component of a Vector3.

Additional resources: WorldToGUIPointWithDepth, GUIPointToWorldRay, RaySnap.