I have an Inventory system with Slots in it. All the Slots are children of Slotholder which has a Graphic Raycast component. I use this component in a child GameObject of the Slot, which is called TriggerEvent to capture events to move stuff around the inventory. Now i wanted to add a tooltip which i can close by clicking anywhere on the screen. To do that i added a screenwide panel behind the tooltip window that will play a role of a giant “button”. And again, to capture clicks i added new script with IPointerDownHandler which disables the window. In Unity documentation i read that it is enough to have Graphic Raycast on the root object in order to capture all the events below. Which doesnt happen. I need to add to that giant “button” another Raycast component, which is ridiculous considering that i have 100 slots.
This is what TriggerEvent has:
- Rect Transform
- Canvas Renderer
- Image (blank with Raycast Target checked)
- Script with all the interfaces
This is what PaneltoCloseToolTip has:
- Rect Transform
- Canvas Renderer
- Image (blank with Raycast Target checked)
- Script with the interface IPointerDownHandler
- Canvas
- and to make it work > Graphics Raycaster
Position in the Hierarchy:
- Slotholder(With Graphic
Raycaster)>Slot>Tooltip(blank
GO)>PaneltoCloseToolTip(also with
With Graphic Raycaster) - Slotholder(With Graphic
Raycaster)>Slot>TriggerEvent
What am i doing wrong?