Observing System Changes #
Hiro enables you to observe changes to the state of any systems used by using the
SystemObserver helper or by subscribing an appropriate
IObserver to that system. This can be useful for updating things such as UI in a reactive way.
The following example demonstrates how changes in the
NakamaSystem can be observed.
Using the SystemObserver #
SystemObserver helper class allows you to bind an action to be triggered whenever the system values change.
Implementing the IObserver interface #
Alternatively you can implement the
IObserver<T> interface. This approach gives you more control and also allows you to observe different system states, such as if the system encounters an error.
Instantiate and use the class, for example in the