- Home /
UI image with collider doesn't work OnMouseDown
Hi, I'm making a project, where I want Europe map and I want to click exactly on one country, so I can't create each country as a button. I've tried making image with collider with function OnMouseDown, but it interacts only when the collider is bigger than canvas.I've tried creating empty object on position where mouse clicked and set the collider as a trigger, where I've call function OnTriggerEnter, but it won't work too.
Comment
if you are using the uGUI (as you mention canvas) why don't you just use the event system?
Answer by Raynoko · Mar 13, 2015 at 01:07 PM
Try to use
button.onClick.AddListener(() -> MyMethod())
... and maybe just add cube as collider behind to UI without render component.