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



边栏推荐
- Blue Bridge Cup SCM module code (external interrupt) (code + comment)
- SQL query, if value is null then return 1 - SQL query, if value is null then return 1
- 【xxl-job】池塘水绿风微暖,记得玉真初见面
- LabVIEW generate application (exe) and installer
- 单片机IO详解(上拉 下拉 准双向 输入 输出 推挽 开漏)
- Several schemes of traffic exposure in kubernetes cluster
- 关于硬件问题造成的MCU死机,过来人简单的谈一谈
- TEMPEST HDMI泄漏接收 2
- Large funds support ecological construction, and Plato farm builds a real meta universe with Dao as its governance
- MySQL (12) -- Notes on changing tables
猜你喜欢

Authentique Photoshop 2022 expérience d'achat partage

5g private network market is in full swing, and it is crucial to solve deployment difficulties in 2022

Large funds support ecological construction, and Plato farm builds a real meta universe with Dao as its governance

基於 KubeSphere 的分級管理實踐

Several schemes of traffic exposure in kubernetes cluster

ES can finally find brother Wukong!

深入解析 Apache BookKeeper 系列:第三篇——读取原理

破万,我用了六年!
![[Shangshui Shuo series] day 4](/img/9f/fb4e2be392756cc7aa8de2e9c5aec7.png)
[Shangshui Shuo series] day 4

14 bs对象.节点名称.name attrs string 获取节点名称 属性 内容
随机推荐
Simple and complete steps of vivado project
Blue Bridge Cup SCM module code (timer) (code + comments)
弱大数定理的意义与证明
Classic paper in the field of character recognition: aster
【pytest】修改allure报告中的logo及参数化
Why use NoSQL with MySQL?
活动报名|Apache Pulsar x KubeSphere 在线 Meetup 火热来袭
College entrance examination voluntary filling, why is the major the last consideration?
Kubernetes 集群中流量暴露的几种方案
Astronomers may use pulsars to detect merged supermassive black holes
MySQL - definition and assignment of variables
太美的承诺因为太年轻
Display purchase Summary - Dell 2705qm BenQ pd2700u
How to get the difference between two dates rounded to hours
How do I get red green blue (RGB) and alpha back from a UIColor object?
Using awk to process input from multiple files
【xxl-job】池塘水绿风微暖,记得玉真初见面
Jameswebb Space Telescope goes into operation to help study interstellar objects
基于 KubeSphere 的分级管理实践
1W words | 40 pictures | hard core es actual combat