- Home /
How find coordinates of ui object in screen space
I have gameobject with image component. It belong to canvas, and this canvas to another canvas.
How can I get x and y of that gameobject at screen space? I'm find only Transform.position and Transform.localPosition. But if I try Camera cameraComp = camera.GetComponent(); Vector3 t = cameraComp.WorldToScreenPoint(gameObject.transform.position); I have a really crazy digits.
Answer by cjdev · Oct 21, 2015 at 05:28 AM
You can get screen space coordinates using the position property on the RectTransform component.
Your answer
Follow this Question
Related Questions
Drawing a (debug) line between anchored UI element and mouse? 0 Answers
Setting values of a Transform childed to a RectTransform giving unexpected results. 1 Answer
How to fit a camera Viewport Rect to a UI Panel 1 Answer
How do I set rect pivot? 2 Answers
Animate RectTransform anchoredPosition relatively to other RectTransform 0 Answers