Sample class showing how and where to call each function of the DeltaMonitor class. this class will check for changes in every enabled CheckForChangeAttribute variable, every update, and then reset all values in LateUpdate. A child class may be derived from this one, allowing the child to simply check the bool changeDetected, during update, (and NOT have to deal with initializing and resetting). (Note: Derived class's Update() would need to call base.Update() or changeMonitor.DetectChanges(), for that to work,) no special editor should be required for derived versions, since DeltaMonitor has a property drawer this class is marked as abstract because it does not contain any members with a DeltaAttribute. This keyword means, basically, that the programmer should derive his/her own class, from this one. That class should have members with DeltaAtribbutes
|
virtual void | LateUpdate () |
| We call ResetValues in late update so that overrides of this class can do processing in Update. After this call is made, all values will need to change again, for a change to be detected. Another option is to use a coroutine to yield until the end of the frame, should that be necessary.
|
|
void | Reset () |
| instantiates the change monitor, specifying THIS object as the one to monitor.
|
|
virtual void | Update () |
| Executes the DetectChanges function on the change monitor. if it has changed, the changeDetected flag will return true until LateUpdate is executed.
|
|
|
bool | changeDetected [get] |
| True when a change has been detected during this UpdateCycle. Flag is reset during LateUpdate.
|
|