/// <summary> /// Move the UI element to the world position /// </summary> /// <param name="objectTransformPosition"></param> public void MoveToClickPoint(Vector3 objectTransformPosition, List <string> names, List <int> levels) { // Get the position on the canvas Vector2 ViewportPosition = Camera.main.WorldToViewportPoint(objectTransformPosition); if (m_canvas == null) { Debug.Log("Canvas null"); } Vector2 proportionalPosition = new Vector2(ViewportPosition.x * m_canvas.sizeDelta.x, ViewportPosition.y * m_canvas.sizeDelta.y); // Set the position and remove the screen offset this.m_rectTransform.localPosition = proportionalPosition - m_uiOffset; m_resizer.Grow().onComplete = delegate { SetInfo(names, levels); }; }