如何获取触摸点下所有UI节点

如何获取触摸点下的所有UI节点

你要的是 调试事件链的所有节点吗?

this.node.on(cc.Node.EventType.TOUCH_START, this.onMainTouch, this, true);

private onMainTouch(evt: cc.Event.EventTouch) {
    const names = [];
    let node: cc.Node = evt.target;

    while (node) {
        names.push(node.name);
        node = node.parent;
    }

    console.log('onMainTouch', names);
}

如果你要的是 触摸节点下包含所有的节点,那就需要先找到触摸的根节点,然后进行循环遍历啦