토글 그룹(Toggle Group) 은 실제로 표시되는 별도의 UI 컨트롤이 아니라 토글 집합의 동작을 조절하기 위한 하나의 방법입니다. 같은 그룹에 속하는 토글 중에서 한 번에 오직 한 개의 토글만 켜질 수 있습니다. 토글 하나를 켜면 다른 모든 토글은 자동으로 꺼집니다.
프로퍼티: | 기능: |
---|---|
Allow Switch Off | 토글을 모두 꺼진 상태로 둘 수 있는지 결정합니다. 이 옵션을 활성화한 상태에서 켜진 토글을 누르면 해당 토글이 꺼지고 그 어떤 토글도 켜지지 않게 됩니다. 이 옵션을 비활성화하면 현재 켜진 토글을 클릭하더라도 해당 토글의 상태가 변경되지 않습니다. |
토글 그룹을 설정하려면 토글 그룹 오브젝트를 그룹에 속한 각 토글의 Group 프로퍼티로 드래그하면 됩니다.
토글 그룹은 사용자가 상호 배타적인 집합의 옵션 중에서 하나를 선택해야 하는 경우에 유용합니다. 흔한 예로는 플레이어 캐릭터 타입, 속도, 프리셋 컬러, 날짜 선택 등이 있습니다. 씬에는 한 개 이상의 토글 그룹 오브젝트를 포함할 수 있으므로 필요하다면 여러 개의 그룹을 생성할 수도 있습니다.
다른 UI 요소와는 달리, Toggle Group 컴포넌트가 있는 오브젝트는 캔버스 오브젝트의 자식일 필요가 없지만 토글은 캔버스 오브젝트의 자식이어야 합니다.
씬이 로드되거나 그룹이 인스턴스화될 때 그룹에 포함된 여러 토글이 켜져 있더라도 토글 그룹은 아무런 제약을 가하지 않습니다. 새로운 토글이 켜질 때에만 다른 모든 토글이 꺼집니다. 따라서 처음부터 한 개의 토글만 켜져 있도록 설정하는 것은 개발자의 자유입니다.
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.