Error on calling 'OnStateChange' method: Object reference not set to an instance of an object

Thank you, this was the issue!