
上QQ阅读APP看书,第一时间看更新
3.4 组件
游戏对象由组件(Component)所组成,不同的功能组件组成了不同功能的游戏对象。
在“Hierarchy”窗口内选中游戏对象以后,单击菜单“Component”中相应菜单选项可以为选中的游戏对象添加组件,如图3-18所示。

图3-18
在“Hierarchy”窗口中,选中游戏对象以后,可以在“Inspector”窗口最下面单击“Add Component”按钮添加组件,这里还可以输入关键词搜索和筛选游戏组件,如图3-19所示。

图3-19
如果是脚本资源,可以在“Hierarchy”窗口内选中游戏对象,然后将脚本从“Project”窗口中拖到“Inspector”窗口中,并设置为组件,如图3-20所示。

图3-20