1
0
mirror of synced 2024-11-24 06:40:11 +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;
}
private void OnDestroy()
{
ComL.Close();
ComR.Close();
}
void Update()
{
if(ComL.IsOpen)
@ -62,11 +67,14 @@ public class Serial : MonoBehaviour
private void SendTouchState()
{
Debug.Log("Sending Touch State");
Debug.Log("Sending Left");
SendTouch(ComL, TouchPackL);
Debug.Log("Sending Right");
SendTouch(ComR, TouchPackR);
if(StartUp)
{
Debug.Log("Sending Touch State");
// Debug.Log("Sending Left");
SendTouch(ComL, TouchPackL);
// Debug.Log("Sending Right");
SendTouch(ComR, TouchPackR);
}
}
private void FixedUpdate() {
//SendTouchState();