- Creator 版本号:1.6
- 目标平台:( iOS / Android / 模拟器)
升级1.6版本之后自定义事件分发,回调函数获取的参数未定义
cc.eventManager.dispatchCustomEvent(“maskSwitch”,{“switch”: “on”});
cc.eventManager.addCustomListener(“maskSwitch”,(event)=>{
if(event.getUserData().switch == “on”)
{
this.mask.active = true;
}
else
{
this.mask.active = false;
}
});
回调函数的event 为undifined,导致出错