데이터 소스와 UI 간에 변경 사항이 모사되는 방식을 정의하려면 바인딩 오브젝트에 대한 바인딩 모드와 업데이트 트리거를 설정할 수 있습니다. 바인딩 모드와 업데이트 트리거는 UI Builder, UXML 또는 C#에서 설정할 수 있습니다.
바인딩 모드는 데이터 소스와 UI 간에 변경 사항이 모사되는 방식을 구성합니다. 다음과 같은 바인딩 모드를 사용할 수 있습니다.
팁: 필요에 따라 적절한 바인딩 모드를 설정해야 합니다. 예를 들어, UI의 변경 사항이 소스에 반영되지 않도록 하려고 하거나 UI가 읽기 전용인 경우 bindingMode
를 BindingMode.ToTarget
으로 설정합니다.
프레임마다 또는 데이터 소스에서 변경 사항이 발생할 때 바인딩 오브젝트를 업데이트할 수 있습니다. 다음과 같은 업데이트 트리거를 사용할 수 있습니다.
업데이트 트리거를 정의하려면 다음 프로퍼티를 사용합니다.
MarkDirty
: 다음 주기 동안 업데이트되도록 바인딩 오브젝트를 dirty
로 설정합니다.updateTrigger
: 데이터 소스 버전에 관계없이 모든 프레임에서 바인딩 오브젝트를 업데이트합니다.참고: 요소별 상태로 바인딩 타입을 유지하지 마십시오. 여러 요소와 프로퍼티에서 동시에 바인딩 인스턴스를 사용할 수 있습니다. 업데이트 및 콜백 중에 바인딩 시스템은 타겟 요소, 바인딩 ID 및 관련 데이터가 포함된 컨텍스트 오브젝트를 전달합니다. 이 컨텍스트 오브젝트를 사용하여 요소별 상태를 저장할 수 있습니다.
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.