Get the position of a picture on the screen. Related to canvas scaler
I recently encountered a problem that drives me crazy.
I want to get the position of a ChildImageA on the screen.
My hierarchical relationship is as follows
Canvas
----Panel
---------ImageA
------------ChildImageA
---------ImageB
ImageA is fixed width and height.
When the resolution is 720*1280, ChildImageA and ImageB are the same position and the same size. When I change the resolution to 1440*2960 (662.7*1280). ChildImageA and ImageB will not be in the same position. But their transform.position is the same. The screen position obtained through RectTransformUtility.WorldToScreenPoint is the same as the screen position of ImageB. But ChildImageA cannot get the screen position.
I guess it is because ImageA is a fixed size. No change through canvas scaler. But I don't know how to get the position of ChildImageA on the screen.
My canvas scaler settings
render mode: screen space-camera
UI Scale Mode: scale with screen size
Reference Resolution: 720*1280
Please help me see how I can get the position of ChildImageA on the screen.
Your answer
Follow this Question
Related Questions
Canvas items using World Space, not Screen Space overlay 0 Answers
UI Elements repositioning and resizing when playing game 1 Answer
How to scale canvas content according to screen resolution? 1 Answer
How to position world space canvas from script 0 Answers
Frustrating problem with UI canvas (lines of canvas flicker around the edges of screen in game!!!) 5 Answers