Reputation: 1549
So right now I have a this hierarchy: Cube → Canvas → RawImage
And I want to get the coordinates of my click on the rawimage, but I dont know where to start right now.
Upvotes: 0
Views: 1839
Reputation: 678
Maybe what you need is to change your approach, I can see some solutions for this.
Change your Canvas
from Overlay
to World Space
and Raycast
the click to get a normal position, not Canvas
position.
If you have Canvas
in Overlay
, I think that Input.mousePosition
is directly proportional to RectTransform.position
, so there is your position.
For both, you can use IPointerClickHandler to detect the click on any UI element.
Upvotes: 2