Skip to content

格式

typescript
UIComponent.guiPrefab

所属类: UIComponent

描述

UI组件需要渲染的ui资源

参数

参数名类型描述

返回值

类型描述
GUIPrefabUI预制件

代码示例

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;