我想在两个挂在不同节点上的两个脚本之间发射和监听事件:
脚本 A,挂在 A 节点上,发射 this.node.emit('myevent', this) ;
脚本 B,挂在 B 节点上,发射 this.node.on('myevent', function() {}, this);
这样事件能调通么?
我想在两个挂在不同节点上的两个脚本之间发射和监听事件:
脚本 A,挂在 A 节点上,发射 this.node.emit('myevent', this) ;
脚本 B,挂在 B 节点上,发射 this.node.on('myevent', function() {}, this);
这样事件能调通么?
在A脚本里面,cc.find(‘B节点’).emit(‘myevent’);