[Unity] UI Button 点击无响应的解决方法

690 阅读1分钟

根据:

forum.unity.com/threads/can…

  1. 检查 UI 之间是否具有遮挡

  2. 检查场景中是否存在 Event System 和 Standalone Input Module 组件

  3. 检查 Button 组件所在的 GameObject 是否具有 Graphic,比如 Image 组件,Graphic 组件的 Raycast Target 是否打开,Button 组件的 Interactable 是否打开

  4. 检查 Button 组件所在的 Canvas 组件所在的 GameObject 是否具有 Graphic Raycaster 组件;检查该 Graphic Raycaster 组件的 Block Mask 和 Button 组件所在的 GameObject 的 Layer 是否设置正确

关于为什么点击 UI 需要 Graphic Raycaster 和 Event System,可见 Graphic Raycaster 的 API

docs.unity3d.com/2018.3/Docu…