I'm experiencing an issue with the PropertyBinding. It works mostly perfect but when I want to do a TwoWay binding, the target needs to have two UnityEvents. If there is only one, the dropdown won't appear and the single UnityEvent that does exist in the Target class won't get automatically assigned.
Steps to reproduce:
Create new class with one property and one UnityEvent (that is invoked when the property changes)
Create source class that implements INotifyPropertyChanged and has a property
Add a PropertyBinding component to some GameObject
Add the first class as the target and assign its property
Select Mode = TwoWay
Add the other INotifyPropertyChanged class as the source and select its property
Run play mode and change the two properties
Behavior:
Source updates target property but not vice versa
If I create two UnityEvents in the target class and select one of them in the dropdown (making sure it's invoked when the property changes ofc), everything works. So it seems that the PropertyBindingEditor class needs to have something selected in the dropdown for two way data binding to work. It won't select the single UnityEvent automatically behind the scenes. I assume that was the idea, to hide the dropdown and select event automatically if there is only one event but unfortunately it doesn't work.
I simply love this data binding implementation, so I really hope there is a way to fix this. I think the problem is in the PropertyBindingEditor somewhere, but my knowledge of EditorGUI scripting and reflection isn't enough to fix it myself.
I'm experiencing an issue with the PropertyBinding. It works mostly perfect but when I want to do a TwoWay binding, the target needs to have two UnityEvents. If there is only one, the dropdown won't appear and the single UnityEvent that does exist in the Target class won't get automatically assigned.
Steps to reproduce:
Behavior: Source updates target property but not vice versa
If I create two UnityEvents in the target class and select one of them in the dropdown (making sure it's invoked when the property changes ofc), everything works. So it seems that the PropertyBindingEditor class needs to have something selected in the dropdown for two way data binding to work. It won't select the single UnityEvent automatically behind the scenes. I assume that was the idea, to hide the dropdown and select event automatically if there is only one event but unfortunately it doesn't work.
I simply love this data binding implementation, so I really hope there is a way to fix this. I think the problem is in the PropertyBindingEditor somewhere, but my knowledge of EditorGUI scripting and reflection isn't enough to fix it myself.