Good evening!
I got a problem. I am using the IBeginDragHandler / IDragHandler / IEndDragHandler interfaces for the dragging system of my UI card elements. This is working fine and I get all the responses, I’m looking for. My cards are parented to a PlayerHand game object in the hierarchy. When I start dragging, my Canvas becomes the new parent of the card I’m currently dragging and as soon as I call the OnEndDrag function, the card returns to its original parent.
My main issue is, that I don’t know how to make my UI elements interacting with the 3D game scene. I know, that the solution for this is probably Raycasting. However, I can not figure out, how to make this work. I tried to use LayerMasks, but ended up in a weird scenario, where I just had set the blockRaycasts property from the CanvasGroup to false in order to get a response from the Layermask underneath my card object. But this is not what I’m looking for, since I want to combine my game logic with the IDropHandler. And that’s the problem - I know that the drag & drop system is UI only.
I found another option in using the RectTransformUtility… did not work out in the end. I made some other experiments before… and it all worked out fine. But that was because my whole project was in 2D and I was able to use RectTransforms as DropZones for my cards. I apologize for my English… I know its not that great, but I think you get the point!
Last sentence: how can I drop my UI elements on a 3D Cube and get a reaction from it?
Thank you very much! ![]()