So I have this script attached to a cube and I am trying to read values trough my serial port 7 but Unity crashes when I click play. It doesn’t happen with the other serial ports I used.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO.Ports;
public class rotate : MonoBehaviour
{
string inputs;
SerialPort sp = new SerialPort("COM7", 115200);
void Start()
{
sp.Open();
}
// Update is called once per frame
void Update()
{
inputs = sp.ReadLine();
string[] quats = inputs.Split(',');
float x = float.Parse(quats[1]);
float y = float.Parse(quats[2]);
float z = float.Parse(quats[3]);
transform.eulerAngles = new Vector3(x,y,z);
}
}