ObservableWatcher
Base class that all other observable watchers derive from.
Description
Component that watches an ObservableObject
for property changes and raises events.
Serialized Fields (Inspector)
observable : ObservableObject
- The object to watch for property changes.raiseOnAwake : bool
- Whether theonPropertyChanged
event should be raised whenAwake()
is called.raiseOnEnable : bool
- Whether theonPropertyChanged
event should be raised whenOnEnable()
is called.raiseOnStart : bool
- Whether theonPropertyChanged
event should be raised whenStart()
is called.
NOTE: The propertyName
will be null
when the onPropertyChanged
event is raised from raiseOnAwake
, raiseOnEnable
, or raiseOnStart
.
Public Events (Inspector)
onPropertyChanging : UnityEvent<ObservableObject, string>
- The actions to perform when a property on the object is changing.onPropertyChanged : UnityEvent<ObservableObject, string>
- The actions to perform when a property on the object has changed.
Public Properties
Observable : ObservableObject
(get) - The object being watched for property changes.
Public Methods
RaisePropertyChanging(string)
- Manually raises theonPropertyChanging
event with the property name provided.RaisePropertyChanged(string)
- Manually raises theonPropertyChanged
event with the property name provided.
NOTE: Manually raising these events will only trigger the UnityEvent
actions on this component.