Search Unity

How to listen the change event for a PropertyField both value change and rebind.

Discussion in 'UI Toolkit' started by watsonsong, Apr 3, 2022.

  1. watsonsong

    watsonsong

    Joined:
    May 13, 2015
    Posts:
    555
    I want to listen the value change event for a PropertyField, but it always missing some use case.
    At the beginning I listen the 'RegisterValueChangeCallback'. But some time it will not callback when the PropertyField rebind.
    Then I tried the 'SerializedPropertyChangeEvent' but somehow it only trigger when the domain first reload. Then it will not triggered any more.
    Again I think maybe I could listen 'SerializedPropertyBindEvent' but it is private.

    So is there a correct way to response change both for "Value Changed" and "Bind"?
     
    Last edited: Apr 3, 2022