That code doesn't have any exit handling stuff at all. I have been fiddling around with Unity a bit today and I personally handled it like this:thylaxene wrote:Can we trouble you for an example of best practise, code flow?
For example here:
https://phidgetseducation.edunext.io/co ... d11b6a85a7
Doesn't seem to show proper clean up on app exit. So I followed that as an example to connect to and register events for the RFID Reader.
Cheers.
Code: Select all
void Update()
{
if(Input.GetKeyDown(KeyCode.Escape))
{
jump.StateChange -= onStateChange;
jump.Close();
joystickX.VoltageRatioChange -= joystickChange;
joystickX.Close();
joystickY.VoltageRatioChange -= joystickChange;
joystickY.Close();
Application.Quit();
}
}