I have a large tiled Grid which an Image UI Element.
It is nested within various UI elements.
OnClick I would like to get the position of click relative to any corner of the grid UI Image.
This seems to be more difficult than it should be? Searches on here yielded no answers.
I would appreciate any steers in the right direction.
Use RectTransformOfElement.GetWorldCorners() function to populate an array with the locations of the element corners. Then OnClick() get the mouse position (input.mousePosition) on the screen at that time. Then compare your mouse position to any corner position in your corners array.
Indeed, translating everything to world co-ords then translating that to screen position will sure be a lot better than creating a nightmare grid of 1000 individual buttons in code. Thanks for the idea, I knew there had to be a better way I was missing.