格式
typescript
UIComponent.guiPrefab所属类: UIComponent
描述
UI组件需要渲染的ui资源
参数
| 参数名 | 类型 | 描述 |
|---|
返回值
| 类型 | 描述 |
|---|---|
GUIPrefab | UI预制件 |
代码示例
typescript
let go = new GameObject("ui");
let uiComponent = go.AddComponent<UIComponent>(UIComponent);
//设置ui资源
uiComponent.guiPrefab = Resources.Load<GUIPrefab>(GUIPrefab, "<UUID>");//<UUID>-为ui文件的uuid
//移除
uiComponent.guiPrefab = null;