1
0
mirror of synced 2024-11-14 18:17:40 +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)
@ -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();
}