How to get position/size information of a UI image
I'm trying to get the Top Left, Top Right, Bottom Left, and Bottom Right coordinates of my UI image after scaling has been applied, in order to instantiate objects on top in the correct positions regardless of the resolution the user's device has.
I am drawing the following image using Canvas UI:
And I have it set up to scale appropriately at different resolutions so it maintains its aspect ratio and stays in the middle. Here's an example of a different resolution:
So while I know what the original dimensions and x/y coordinates are, I want to know what the coordinates end up being after scaling is applied so I can work out the algorithm to position any new objects properly.
Is there anything existing that provides this information?
Your answer
Follow this Question
Related Questions
How to offset a RectTransform? 0 Answers
Can someone help me with this canvas warning? 0 Answers
Unity 3D interface says my button has a rectTransform C# script says otherwise 0 Answers
RectTransform scale of my Canvas changed when I build on Android 1 Answer
Updated with UI text element not correct (same frame) 0 Answers