format
typescript
Control.GetChildByIndex(index)class: Control
description
Get the child control of the current control based on the index (index starts from 0).
parameter
| param_name | type | description |
|---|---|---|
| index | number | The index value. |
reture
| type | description |
|---|---|
Control | The child control. |
code example
typeScript
let go = new GameObject("ui");
let uiComponent = go.AddComponent<UIComponent>(UIComponent);
let canvas = uiComponent.canvas;
let button = canvas.FindChild("Button");
button.GetChildByIndex(0);