- Home /
Drag and drop not working when sprite is overlapping with other objects.
Hi, So i have a little problem with my Drag and Drop system. When my sprite with the Drag script completly overlaps with the Drop or Drag zone i just cant grab it. If its just half overlaping i can drag it perfectly on the corners wich are not overlaping. I dont no why this is not working but i think its not a big problem. One more information: The sprite is attachted to the panel wich is overlaping with the sprite. Thank you a lot Cryttexx
Answer by Legend_Bacon · Mar 02, 2018 at 06:21 PM
Hello there,
I'm not sure exactly how you've implemented your drag & drop system, but I know I had this issue when building mine with Unity's UI system. Basically, you want to make sure that all elements that could be in front of your object have their "Raycast Target" set to false. That way, they ignore clicks and you can select the object behind it.
If you have multiple objects you need to set at the same time, you can also put them under an object with a "Canvas Group" component on it. Then, you can just set the Canvas Group to make them accept/ignore clicks as you will.
I hope that helps!
Cheers,
~LegendBacon
Thank you a lot. The solution was setting "Raycast Target" to false. Thank you very much.
Your answer
Follow this Question
Related Questions
How to turn on Raycast Target on Drag? 0 Answers
Question on Tutorial: Panes, Panels, Windows 0 Answers
2D boomerang effect 1 Answer
How to make everything inside a panel visible and on top of everything ? 1 Answer
triplex 2d unity game 0 Answers