Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.1版本在星星上暂存Game对象引用出错 #26

Open
mohaiyang6 opened this issue Aug 12, 2019 · 1 comment
Open

2.1版本在星星上暂存Game对象引用出错 #26

mohaiyang6 opened this issue Aug 12, 2019 · 1 comment

Comments

@mohaiyang6
Copy link

newStar.getComponent('Star').game=this;
不注释出现错误,注释无法实现功能
报错:(271)ERROR: Uncaught TypeError: Cannot read property 'length' of null, location: src/cocos2d-jsb.js:0:0
Simulator: E/jswrapper (534): [ERROR] (..\cocos\scripting\js-bindings\jswrapper\v8\Object.cpp, 534): Invoking function (1012C818) failed!

@watdenson
Copy link

第一步:在Game.js 里把 newStar.getComponent('Star').game=this; 替换成newStar.game=this
第二步:在Star.js里把this.game替换成this.node.game

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants