一个可以避免射线和UGUI点击冲突的方案 //如果当前点击了UI则不发射线 if(EventSystem.current.currentSelectedGameobject != null) return;