OnDeactivate function

Learn technical details about the OnDeactivate function.