__开关__控件是让用户打开或关闭某个选项的复选框。
属性: | 功能: |
---|---|
Interactable | 此组件是否接受输入?请参阅 Interactable。 |
Transition | 确定控件以何种方式对用户操作进行可视化响应的属性。请参阅过渡选项。 |
Navigation | 确定控件顺序的属性。请参阅导航选项。 |
Is On | 开关在开始时是否为打开状态? |
Toggle Transition | 开关在其值发生变化时以图形方式作出的反应。提供的选项为 None_(即复选标记直接出现或消失)和 Fade_(即复选标记淡入或淡出)。 |
Graphic | 用于复选标记的图像。 |
Group | 此开关所属的开关组(如果有)。 |
属性: | 功能: |
---|---|
On Value Changed | 单击开关时调用的 UnityEvent。该事件可将当前状态作为 bool 类型动态参数发送。 |
开关控件可让用户打开或关闭某个选项。如果一次只能打开一组选项中的一个选项,还可以将多个开关组合到一个开关组中。
开关有一个名为 On Value Changed 的事件,当用户更改当前值时会响应。新值作为 boolean
参数传递给事件函数。开关的典型用例包括:
请注意,__开关__是为子项提供可单击区域的父项。如果__开关__没有子项(或者子项被禁用),则不可单击开关。
Toggle
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.