Close Serial Ports in OnDestroy
This commit is contained in:
parent
3ac3190cdb
commit
05da9f6caa
@ -48,6 +48,11 @@ public class Serial : MonoBehaviour
|
||||
ColliderToSerial.touchDidChange += SendTouchState;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
ComL.Close();
|
||||
ComR.Close();
|
||||
}
|
||||
void Update()
|
||||
{
|
||||
if(ComL.IsOpen)
|
||||
@ -61,13 +66,16 @@ public class Serial : MonoBehaviour
|
||||
}
|
||||
|
||||
private void SendTouchState()
|
||||
{
|
||||
if(StartUp)
|
||||
{
|
||||
Debug.Log("Sending Touch State");
|
||||
Debug.Log("Sending Left");
|
||||
// Debug.Log("Sending Left");
|
||||
SendTouch(ComL, TouchPackL);
|
||||
Debug.Log("Sending Right");
|
||||
// Debug.Log("Sending Right");
|
||||
SendTouch(ComR, TouchPackR);
|
||||
}
|
||||
}
|
||||
private void FixedUpdate() {
|
||||
//SendTouchState();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user