format
typescript
Control.canvasclass: Control
description
The Canvas that the current control is on.
The Canvas can be thought of as the drawing panel for UI elements. It controls the rendering of UI elements and other properties.
parameter
| param_name | type | description |
|---|
reture
| type | description |
|---|---|
Canvas|null | The Canvas that the control is on. |
code example
typeScript
let go = new GameObject("ui");
let uiComponent = go.AddComponent<UIComponent>(UIComponent);
let canvas = uiComponent.canvas;
let button = canvas.FindChild("Button");
button.canvas;