1
0
mirror of synced 2024-11-27 23:50:50 +01:00

Close Serial Ports in OnDestroy

This commit is contained in:
Kylemc1413 2022-05-24 20:48:15 -04:00
parent 3ac3190cdb
commit 05da9f6caa

View File

@ -48,6 +48,11 @@ public class Serial : MonoBehaviour
ColliderToSerial.touchDidChange += SendTouchState; ColliderToSerial.touchDidChange += SendTouchState;
} }
private void OnDestroy()
{
ComL.Close();
ComR.Close();
}
void Update() void Update()
{ {
if(ComL.IsOpen) if(ComL.IsOpen)
@ -62,11 +67,14 @@ public class Serial : MonoBehaviour
private void SendTouchState() private void SendTouchState()
{ {
Debug.Log("Sending Touch State"); if(StartUp)
Debug.Log("Sending Left"); {
SendTouch(ComL, TouchPackL); Debug.Log("Sending Touch State");
Debug.Log("Sending Right"); // Debug.Log("Sending Left");
SendTouch(ComR, TouchPackR); SendTouch(ComL, TouchPackL);
// Debug.Log("Sending Right");
SendTouch(ComR, TouchPackR);
}
} }
private void FixedUpdate() { private void FixedUpdate() {
//SendTouchState(); //SendTouchState();