How can I get the click position on a Rawimage ui element?
So I have a world space canvas acting as a minimap. This is a rawimage using a render texture. I want to draw a raycast from the camera rendering to the texture.
I managed to find this: http://answers.unity3d.com/questions/1018336/is-there-a-way-to-click-on-a-render-texture-to-sel.html
This works perfectly well... for non UI objects. I've been trying in vain for several hours to get the same method working on my UI using EventSystem.current.RaycastAll and a List.
Any help at all will be appreciated. This one is driving me a bit nuts!
Hello! I recently began looking to do the same thing! And I too need this to work in my UI on a raw image / render texture. I have it working perfectly with non-UI just like you and I even used the same source you did! lol
Here is my thread on the Unity forums: https://forum.unity.com/threads/$$anonymous$$imap-help.525486/
I was wondering if you ever found a solution because this is also driving me crazy!
Thanks man!
Hello, I'm sorry I never answered my own question (I hate it when people do that, too!) but I DID find a solution to my problem. Unfortunately I can't quite recall what I did it was so long ago, but I'll certainly take a look when I get chance. If you like, I could share the project files too and see if that helps you. I have a hunch on how I fixed it, but I'll let you know.
Could you tell me exactly what problem you are having? I seem to recall having an issue where the coordinates came back as 0,0 regardless of where the mouse click raycasted to on the surface. is this similar to your problem?
$$anonymous$$aintain hope! It is possible! =P
Yes! :D
That was one of my many issues trying to click the Raw Image I would only ever get (0.0,0.0) so I gave up on that approach. I have tried it at least a dozen ways in the last 24 hours.
But I'm still back at square one. It works flawlessly when I project the orthographic camera to a 3d plane. But when I project it to my Raw Image it dies.. lol and I can't get it to do anything.
Sharing the project would be fantastic!
Your answer
![](https://koobas.hobune.stream/wayback/20220612071525im_/https://answers.unity.com/themes/thub/images/avi.jpg)