当前位置:网站首页>Cocos learning diary 3 - API acquisition nodes and components
Cocos learning diary 3 - API acquisition nodes and components
2022-06-25 07:24:00 【herb. dr】
Catalog
3、 ... and 、 Script component access
One 、API Access to the node
1.1 principle
1、 Current node this.node : cc.Node
for example let node : cc.Node = this.node;
2、 Parent node this.node.parent
3、 Child node this.node.children : cc.Node[]
4、 Global search
for example target = cc.find("Canvas/ page / name ")
5、 Find child nodes
for example target = cc.find("xx/yy", someNode)
1.2 Case study

Two 、API Get components
For nodes already node,
You can get the component object it is attached to
Get components
let label = node.getComponent(c.Label)
Get custom type components ( Script components )
let script = node.getComponent(' YourScript")


3、 ... and 、 Script component access



边栏推荐
- 破万,我用了六年!
- 【xxl-job】池塘水绿风微暖,记得玉真初见面
- Efficient exploration | an application practice of ES geographical location query
- 几款不错的天气插件
- 正版photoshop2022購買體驗經曆分享
- The king scheme in distributed locks - redisson
- Finally, when you open source the applet ~
- Why is true == "true" true in R- Why TRUE == “TRUE” is TRUE in R?
- lotus windowPoSt 手动触发时空证明计算
- [XXL job] the pond is green and the wind is warm. I remember that Yu Zhen first met
猜你喜欢

We are different

I have used it for six years!

Classic paper in the field of character recognition: aster

诸葛亮 VS 庞统,拿下分布式 Paxos

我与CSDN的一年时光及大学经验分享

正版photoshop2022購買體驗經曆分享
![[Shangshui Shuo series] day 5](/img/83/28834addd8198d4bcdc718eccf5754.png)
[Shangshui Shuo series] day 5

48 pictures | teach you the performance monitoring, pressure testing and tuning of microservices by hand

网络是怎样连接的?

稳压二极管的原理,它有什么作用?
随机推荐
Why is true == "true" true in R- Why TRUE == “TRUE” is TRUE in R?
[he doesn't mention love, but every word is love]
我们不一样
Blue Bridge Cup SCM module code (LED) (code + comments)
终于等到你,小程序开源啦~
In depth analysis of Apache bookkeeper series: Part 3 - reading principle
威迈斯新能源冲刺科创板:年营收17亿 应收账款账面价值近4亿
TEMPEST HDMI泄漏接收 1
Rotation vector (rotation matrix) and Euler angle
lotus windowPoSt 手动触发时空证明计算
Icon already includes gloss effects
Blue Bridge Cup SCM module code (matrix key) (code + comments)
Solar orbiter captured the full picture of the largest prominence eruption in history
Kube scheduler source code analysis (1) - initialization and startup analysis
Using awk to process input from multiple files
lotus v1.16.0-rc3 calibnet
Wow, it's so rich.
Efficient exploration | an application practice of ES geographical location query
We are different
高考志愿填报,为啥专业最后考虑?