Skip to content

Instantly share code, notes, and snippets.

View mixadze1's full-sized avatar
🕶️

mixadze1

🕶️
View GitHub Profile
@unitycoder
unitycoder / UI2World.cs
Last active July 1, 2024 20:19
Move UI element to world gameobject position
// https://forum.unity.com/threads/overlay-canvas-and-world-space-coordinates.291108/#post-9627593
// translating between overlay canvas and world space coordinates
uiObject.transform.position = RectTransformUtility.WorldToScreenPoint(Camera.main, worldObject.transform.TransformPoint(Vector3.zero));
--------
// http://answers.unity3d.com/questions/799616/unity-46-beta-19-how-to-convert-from-world-space-t.html
//this is your object that you want to have the UI element hovering over