format
typescript
Control.AddChild(child)class: Control
description
Add a child control.
parameter
| param_name | type | description |
|---|---|---|
| child | Control | The child control. |
reture
| type | description |
|---|---|
void |
code example
typeScript
let go = new GameObject("ui");
let uiComponent = go.AddComponent<UIComponent>(UIComponent);
let canvas = uiComponent.canvas;
let button = canvas.FindChild("Button");
let image = canvas.FindChild("Image");
button.AddChild(image);