0

I have a simple task - detect if mouse cursor over my UI GameObject with Image component. But...

IPointerDownHandler and others i can't use because as i understand this must be on object with image. I want to detect intersection with GameObject as container (some images inside it) Rect.Contatins from RectTransfrom also don't work becase size of RectTransform different with image size. And i don't want to set special script on each object with image to catch some callbacks.

Do you know simple way to detect intersection of mouse cursor with UI GameObject Image (no special scripts on it)?

Thanks!

Vogd
  • 1
  • 2
  • `IPointerDownHandler` is used to detect clicks on GameObjects. Why don't you want to use them? If you have don't want to use it then you have to write more code which is not worth it and is basically why `IPointerDownHandler` was made in the first place so that you don't have to write that – Programmer Apr 21 '18 at 07:40
  • Because as i tested IPointerDownHandler don't work on gameobject-container with gameobject-images inside it. Am i missing something? – Vogd Apr 21 '18 at 10:21
  • Not sure what you mean by "gameobject-container". Is is 2D, 3D or a Sprite? Can you post a screenshot of the Inspector of that object? – Programmer Apr 21 '18 at 10:25
  • Oh well see the duplicate for how to detect click on any type of object in Unity. – Programmer Apr 21 '18 at 11:05

0 Answers0