Unity/문제 해결

[Unity/UI] 버튼 위로 이미지 배치 시 영향 받지 않도록 하는 방법 (Overlapping Buttons)

sorry0101 2022. 11. 18. 11:42

< 문제 >

이런식으로 겹쳐져 있고 네모Button(■)을 눌러야하는 상황인데 큰 원(O) Image가 위에 있어서 input이 정상적으로 되지 않았음

< 해결방법 >

큰 원(O) Image 의 Raycast Target을 비활성화 시키면 button input이 정상적으로 눌러질 수 있었음
button도 화면에 raycast를 쏴서 click을 받는 것이기 때문에 raycast의 영향을 받지 않도록 하면 되는 것이었음



참고
https://stackoverflow.com/questions/36259386/unity-button-click-doesnt-work-when-overlap-a-have-collider2d-object-in-another

 

Unity Button Click doesn't work When overlap a have collider2d object in another canvas

I am developing a 2d game with Unity. I have a popup settings dialog and When Player clicked settings button it coming to screen on the other objects. Game objects have got Collider2d component an...

stackoverflow.com