- Home /
How do I fix clashing box colliders on two separate sprites?
Hey everyone! I'm fairly new to using Unity and have learned a lot on how the program handles sprites, animation, and UI interaction. As of right now I'm building an app that will generate a random melody for you.
The problem I'm having is a little tough to explain, so I'll provide a video so you can see the problem. |
So, I have 2 objects that I need to work at the same time in order for it to be UI friendly.
1. The first object is a drawer that opens and closes, and inside has a bunch of buttons (sprites). As of right now I'm only using the button labeled "C" for debugging.
2. The second item is that button.
These both need a box collider around them since they have OnMouseOver() methods attached to their code. However, when I try to click the button in the drawer, the drawer closes and am unable to press the button anymore.
I know the problem is the Box Colliders clashing with eachother, but I haven't been able to find a video/unity answer that fixes this.
If any of you guys know a way to fix this, I would very much appreciate it. I'm sure this isn't the first time someone has mentioned this problem but again I haven't found one, so again I appreciate the help.
(Btw if you need my code, I'll provide pastebin links in the comments since last time the code block broke my code and smashed it into lines.)
Why would the drawer's collider be over the buttons? What angle is it viewed from?
The drawer's collider is not over the buttons, it's under. The drawers are drawn first, then the buttons on top. The angle should be straight on since it's a simple 2d app. The issue is when I go into the button's collider I'm no longer on the drawer's which causes it to close.
Your answer
Follow this Question
Related Questions
Polygon2D colliders getting messed up by rotation 0 Answers
Is it possible to change the texture property of a material via Animation clip? 2 Answers
Proper/Standard way to create a top down / isometric sprite sorting solution 1 Answer
Sprite plane doesn't cast shadow on another sprite plane 1 Answer