cocos creator~查找组件或者节点的方法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/themagickeyjianan/article/details/86259629

1)直接根据Canvas下面的查找

cc.find("Canvas/btn_rope").zIndex = 2000;
cc.find("Canvas/rope").zIndex = 1000;

2)根据组件节点查找子节点

this.node.getChildByName("xxx")

3)查找game_scene组件

 this.game_scene = cc.find("Canvas").getComponent("game_scene");

猜你喜欢

转载自blog.csdn.net/themagickeyjianan/article/details/86259629
今日推荐