fix raycastUI (#4440)

This commit is contained in:
jiaxin.lai
2019-05-17 16:16:33 +08:00
committed by Weiliang Wang
parent 7f5d84116f
commit 59b55d9260
+1 -1
View File
@@ -257,7 +257,7 @@ export class RenderScene {
public raycastUI (worldRay: ray, mask: number = Layers.UI): IRaycastResult[] {
poolUI.reset();
const canvasComs = cc.director.getScene().getComponentsInChildren(cc.CanvasComponent);
if (canvasComs != null) {
if (canvasComs != null && canvasComs.length > 0) {
const canvasNode = canvasComs[0].node as Node;
if (canvasNode != null && canvasNode.active) {
this._raycastUINodeRecursiveChildren(worldRay, mask, canvasNode);