[英]Unity Button Click doesn't work When overlap a have collider2d object in another canvas
I am developing a 2d game with Unity. 我正在用Unity开发2D游戏。 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 and If a button over an game object which has Collider2d compopnent, Button click action doesn't work. 游戏对象具有Collider2d组件,并且如果具有Collider2d功能的游戏对象上的按钮不起作用,则按钮单击动作无效。
I use different layers and canvas, and I set z index -20 and more but result is same button click doesn't work. 我使用不同的图层和画布,并且将z索引设置为-20或更高,但结果是相同的按钮单击不起作用。
The problem was not only about collider overlapping. 问题不仅在于对撞机重叠。 First part of the problem was image and button overlapping.
问题的第一部分是图像和按钮重叠。
I removed the raycast target for Image components in a grid. 我删除了网格中Image组件的raycast目标。
But already I can't click button when overlap with a 2d collider. 但是已经无法在与2d对撞机重叠时单击按钮。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.