Uncaught TypeError: Cannot read property ‘getComponent’ of null, location: src/cocos2d-jsb.81fc6.js:0:0
STACK:
[0]getComponent@src/cocos2d-jsb.81fc6.js:11463
[1]anonymous@src/project.e2e7c.js:9026
[2]anonymous@src/cocos2d-jsb.81fc6.js:18458
[3]anonymous@src/cocos2d-jsb.81fc6.js:24004
[4]fireTimeout@jsb-adapter/jsb-builtin.js:2033
[5]tick@jsb-adapter/jsb-builtin.js:1995
this.xxx.getComponent(“xxxx”).update();
方法里面
cc.director.getScene().getChildByName(“xxxx”).addChild(prefabs);
prefabs.getComponent(“createroomprefab”).set_club_id(clubid);
prefabs是动态加载的
检查代码逻辑出现 ‘getComponent’ of null 基本都是代码逻辑问题
web跑正常 app就是有时候会不正常 有时候正常
会出现点这个场景下任何挂载在场景下的节点都报这个错 场景明明在了
这个错误是说这个节点是null 检查是否没有实例化好就调用了
1赞