I’ve got a 2D scene with a hex-tilemap on it. I’ve set the Z for both the grid and tilemap to -1.
There are then several sprites that I want to be able to drag n drop onto the tilemap and have them know where they are on the tilemap.
I have this all working fine with a single sprite. The moment I add/activate a second sprite in the scene, I can drop sprites onto the tilemap, but can’t pick them up again. if I deactivate the tilemap, then the pickup works.
I’ve debugged this in a ton different ways and finally gotten to doing Raycasts from the MousePosition and looking at the order of the Raycast hits. In the situation where only one Sprite exists, the sprite always ends up at the top of the raycast array, which seems reasonable because the sprite is rendered on top of the tilemap.
When 2 sprites exist, the tilemap shows up at the top of the raycast array. In all cases, the “distance” of the Raycast2D is 0 for all entities regardless of what I do with the Z coordinate. Is there a way to affect this in 2D?
I am almost on the pathway to make a single ClickController that knows how to sort through the Raycast lists itself, but if I can use the OnMouse* events on the individual objects, I expect that would be easier to maintain.