WorldToGUIPoint(Vector3)
Convert a world space point to a 2D GUI position.
Read time 1 minuteLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEditor
- Assembly: UnityEditor
public static Vector2 WorldToGUIPoint(Vector3 world)
Parameters
Point in world space.
Returns
Type | Description |
|---|---|
| Vector2 | A Vector2 where the x and y values are the 2D GUI position of the world space point. |
Remarks
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, returns x/y coordinates that might be outside the SceneView’s pixel rect.
WorldToGUIPointWorldToGUIPointAdditional Resources: HandleUtility.WorldToGUIPointWithDepth, HandleUtility.GUIPointToWorldRay, HandleUtility.RaySnap.