1 2 3 4 5
| Vector3 screenPos = (Camera)mainCamera.WorldToScreenPoint(worldPos); if (RectTransformUtility.ScreenPointToLocalPointInRectangle( (RectTransform)uiWindow.transform, screenPos, (Camera)uiCamera, out Vector2 localPoint)) { transform.localPosition = localPoint + extraOffset + verticalOffset; }
|