当前位置:网站首页>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



边栏推荐
猜你喜欢

Practice of hierarchical management based on kubesphere

威迈斯新能源冲刺科创板:年营收17亿 应收账款账面价值近4亿
![[Introduction aux uvm== > Episode 9] ~ modèle de registre, intégration du modèle de registre, méthode conventionnelle du modèle de registre, scénario d'application du modèle de registre](/img/c0/b373a3f0e0c7b35f42c8a28b4d4f74.png)
[Introduction aux uvm== > Episode 9] ~ modèle de registre, intégration du modèle de registre, méthode conventionnelle du modèle de registre, scénario d'application du modèle de registre

【pytest】修改allure报告中的logo及参数化

Sqlmap advanced use – cookies

分布式锁中的王者方案 - Redisson

有了 MySQL 为什么要用 NoSQL?

The e-book "action guide for large organizations to further promote zero code application platform" was officially released!
![[he doesn't mention love, but every word is love]](/img/28/0c3ddad3dc9b1ef8d0618164f39e53.png)
[he doesn't mention love, but every word is love]

Ppt template of small fresh open class education courseware
随机推荐
14 bs对象.节点名称.name attrs string 获取节点名称 属性 内容
Americo technology launches professional desktop video editing solution
Why use NoSQL with MySQL?
5g private network market is in full swing, and it is crucial to solve deployment difficulties in 2022
Blue Bridge Cup SCM module code (matrix key) (code + comments)
【LeetCode】two num·两数之和
The perfect presentation of Dao in the metauniverse, and platofarm creates a farm themed metauniverse
How do I get red green blue (RGB) and alpha back from a UIColor object?
13 `bs_duixiang.tag标签`得到一个tag对象
Omni toolbox direct download
Classic paper in the field of character recognition: aster
单片机IO详解(上拉 下拉 准双向 输入 输出 推挽 开漏)
Is it possible to use Jasmine's toHaveBeenCalledWith matcher with a regular expression?
Kube scheduler source code analysis (1) - initialization and startup analysis
LTpowerCAD II和LTpowerPlanner III
Redirect to previous page after login? PHP - Redirecting to previous page after login? PHP
How do I know if mysqlnd is an active driver- How to know if MySQLnd is the active driver?
太美的承诺因为太年轻
Shell命令学习
Enter an integer with any number of bits, and output the sum of each bit of the number. For example: 1234 – > 10