You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Nate Turley edited this page Mar 11, 2020
·
3 revisions
Anatomy of a Bindable Property
publicstringText{get{return_text;}// Getter returns backing fieldset{if(value!=_text)// Only update field if value is changed{_text=value;// Set backing fieldNotifyPropertyChanged(nameof(Text));// Alert subscribers to change in Property with name of property}}}[SerializeField]string _text;
Visual Studio Code Snippet
Included in Unity-MVVM is a Visual Studio code snippet which is helpful for writing bindable properties in your ViewModel. To install on Windows, open the .snippet file with Visual Studio.
Once this is installed type bindprop + (Tabx2) to create a bindable property snippet