void Awake() { UnitySerialPort.BaudRate = _baudRate; Instance = this; foreach (var availablePort in SerialPort.GetPortNames()) { comPorts.Add(availablePort); } if (comPorts.Count >= 1) { UnitySerialPort.ComPort = comPorts[0]; } callback = new Popup.ListCallBack(PrintResults); guiStyle.alignment = TextAnchor.MiddleCenter; guiStyle.normal.textColor = new Color(1f, 1f, 1f, 1f); guiStyle.focused.textColor = Color.red; var tex = new Texture2D(2, 2); var colors = new Color[4]; for (int i = 0; i < colors.Length; i++) colors[i] = Color.white; tex.SetPixels(colors); tex.Apply(); guiStyle.hover.background = tex; guiStyle.onHover.background = tex; guiStyle.padding.left = guiStyle.padding.right = guiStyle.padding.top = guiStyle.padding.bottom = 4; guiStyle.onActive.background = tex; }
public UnitySerialPort(XBeeManager manager) { Instance = this; PopulateComPorts(); if (OpenPortOnStart) { OpenSerialPort(); } }