从 Scene 视图中可以访问使用工具模式 API 创建的自定义工具。您可以通过以下方式来访问自定义工具:
右键单击 Scene 视图工具栏中的 Available Custom Editor Tools按钮。
有些自定义工具是全局性的,而有些则是依赖于上下文:
全局工具会影响任何类型的游戏对象,并且无论您选择哪种类型的游戏对象,全局工具都始终可用。例如,变换组件工具可用于任何游戏对象,因此始终可供访问。
上下文自定义工具仅影响特定类型的游戏对象,并且仅在您选择该类型的游戏对象时才可用。例如,仅当选择了光源时,才可以访问光源的自定义操控器。
要激活自定义 Editor 工具,请右键单击 Scene 视图工具栏中的 Available Custom Editor Tools 按钮。
此时将打开一个菜单,并分为以下几个部分:
A. Recent:列出最近使用过的全局工具。
只有在当前会话中首次激活全局工具时,才会出现此部分。
B. Selection:列出可影响当前所选的一个或多个游戏对象的上下文工具。
如果项目中没有影响所选对象的自定义工具,则不会出现此部分。
C. Available:列出所有可用的全局工具。
只要项目包含自定义工具,此部分就会始终出现。
如果项目不包含任何自定义工具,菜单将显示一条消息,内容为“No custom tools available”。
从菜单中选择工具后,Available Custom Editor Tools 按钮将变为选定工具的图标。
可切换 Component Editor Tools 面板来从 Scene 视图主窗口上叠加的工具栏中访问自定义 Editor 工具。
该面板包含所有上下文自定义工具的按钮,这些工具可影响一个或多个选定游戏对象。只要选定对象改变,该面板就会自动更新。
单击一个按钮以激活一个工具。
再次单击按钮可在当前工具与最后激活的工具之间切换。
如果项目没有使用任何自定义工具,则该面板为空。
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.