Unity 允许为游戏对象和脚本分配自定义图标。这些图标与光源和摄像机等的内置图标一起显示在 Scene 视图中。使用 Gizmos 菜单可控制在 Scene 视图中绘制图标的方式。
要更改游戏对象的图标,请在 Hierarchy 窗口或 Scene 视图中选择游戏对象,然后在 Inspector 窗口中的游戏对象名称左侧单击 Select Icon 按钮(蓝色立方体,在下图中用红色方框突出显示)。
将图标分配给游戏对象后,图标将在 Scene 视图中显示在该游戏对象(以及之后的任何重复项)的上方。还可以将图标分配给预制件,从而将图标应用于场景中该预制件的所有实例。
要为脚本指定自定义图标,请在 Project 窗口中选择脚本,然后在 Inspector 窗口中的脚本名称左侧单击 Select Icon 按钮(C# 文件图标,在下图中以红色方框突出显示)。
为脚本分配某个图标后,Scene 视图中任何附加了此脚本的游戏对象上方都会显示此图标。
无论是为游戏对象还是脚本分配图标,弹出的 Select Icon 菜单都是相同的:
Select Icon 菜单包含若干个内置图标。单击某个图标将其选中,或单击 Other… 从项目资源中选择要用作图标的图像。
内置图标分为两类:__标签图标__和__纯图像图标__。
标签图标
将标签图标分配给游戏对象或脚本,可在 Scene 视图中显示游戏对象的名称。
纯图像图标
纯图像图标不显示游戏对象的名称。这些图标对于分配可能没有可视表示的游戏对象(例如,导航路点)非常有用。分配图标后,即可在 Scene 视图中查看并单击该图标来选择和移动本来不可见的游戏对象。
项目中的任何资源图像也可以用作图标。例如,骷髅头图标可用于指示关卡中的危险区域。
注意:更改资源的图标后,资源本身会被标记为已修改,因此会被版本控制系统选中。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.