How to get screen point with any scale
Greetings, I'm trying to get the screen space position of a game object I'm rendering in my UI, the object is not properly on my canvas (which is a Screen Space - Camera) so what I'm doing is
var point = Viewer.Scene.camera.WorldToScreenPoint(myObject.transform.position);
Vector2 finalPosition; RectTransformUtility.ScreenPointToLocalPointInRectangle(Viewer.rectTransform, point, Camera.main, out finalPosition);
I'm calling these lines from a panel inside the canvas, this panel can scale to fullscreen and back, when in fullscreen it has the screen size and localScale = Vector3.one but when it's not it has different sizes, can be any size or scale. My issue is that when it's not fullscreen (so no 1,1,1 local scale) the finalPosition and also the screen position are completely wrong, what am I missing?
Thanks in advance
Your answer
![](https://koobas.hobune.stream/wayback/20220612185100im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
UI elements not visible on iPhone 5s 0 Answers
image for joystick by percentage of screen? 1 Answer
How to make mesh render objects overlay UI? 1 Answer
UI Mask for List VS Canvas for Text 0 Answers