Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Position a UI element based on a World Position
Vector2 screenPos = camera.WorldToViewportPoint( worldPosition );
screenPos.x *= guiCanvas.rect.width;
screenPos.y *= guiCanvas.rect.height;
// the element should be anchored bottom/left
uiElement.anchoredPosition = screenPos;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.