- Home /
How do I make a button interactible when it's overlaped with an other button ?,How to make a button hit area fit the shape of its image
I'm currently trying to make a 2D interactible map, and make it possible to click on the regions, and highlight them. However, since the regions buttons' hit areas are square-shaped, they overlap.
Is there a way to change these areas' shapes? Or to make a button hit area interactible even from behind another object, while still making said object interactible ? I tried messing a bit with raycasts, but I don't really understand what they are or what they do.
Please, help me :(
Answer by Casiell · Nov 08, 2018 at 08:53 AM
You can add a polygon collider 2D to each area and match it with the borders manually. Then, uinstead of UI.Button component you can add a custom script to each area with MonoBehaviour.OnMouseUpAsButton() method in it.
Your answer
Follow this Question
Related Questions
Player sinking into walls and floor with Raycasts 1 Answer
2D raycast on mobile is giving weird results 0 Answers
How to determine if the player can jump, without using raycasts. (2D) 1 Answer
Programming 2D buttons 3 Answers
Inconsistent Reflection/Ricochet of 2D Lines at Specific Angles via Raycasting and 2D Colliders 2 Answers