格式
typescript
Control.childCount所属类: Control
描述
获取当前控件的子控件数量。
参数
| 参数名 | 类型 | 描述 |
|---|
返回值
| 类型 | 描述 |
|---|---|
number | 子控件数量 |
代码示例
typeScript
let go = new GameObject("ui");
let uiComponent = go.AddComponent<UIComponent>(UIComponent);
let canvas = uiComponent.canvas;
let button = canvas.FindChild(Button,"Button");
button.childCount;