Area2D mouse events within viewport aren't working.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By compmstr

I’m working on a project that’s essentially Scrabble.
I’ve got a main board that should be able to scroll, and a fixed ‘tray’ of tiles at the bottom of the screen.
The way I have it set up is with a VBoxContainer, and two ViewportContainers containing a viewport into the board and the tray. Both of those are tileMaps. The actual game pieces are added as children of the tile maps. When I run the game piece scene, dragging via Area2D_mouse_enter/exit works fine, but not when the tiles are part of the main scene.

I’ve set up mouse ignore on all of the containers, and I’ve tested with logging on each of those levels of containers to make sure the mouse events are getting down that low.

At this point though, it looks like the viewport is dropping the mouse events, and so the game pieces that are under the viewport don’t appear to get any mouse events at all.

Any help would be much appreciated.

My main game board scene

Looks like this issue
Sub - viewports still don't handle _unhandled_input or CollisionObject._input_event() · Issue #17326 · godotengine/godot · GitHub

If is that, try one of the workarounds mentioned there.

eons | 2018-08-31 23:31

That appears to be the issue I’m having, but as they’ve said in the issue, the workarounds didn’t really work for my case. Thanks for tracking that down though.

I’ve decided to approach this a different way, and have the tiles added above those viewports. I’ll probably just need to set the z-index of the tray container to be above everything else on the Board layer. Thanks again!

compmstr | 2018-09-01 15:34