private void Awake() { mSerialManager = GameObject.FindGameObjectWithTag(mGameManagerTag).GetComponent <SerialInputManager>(); mBaudrateInputField.text = mSerialManager.GetBaudrate(); mPortNameInputField.text = mPortName; }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); if (mUseSerial) { SerialPortEventManager.OnRotationChanged += WriteMowerPositionToSerialPort; if (mSerialPort == null) { Debug.Assert(mPortName != null); mSerialPort = new SerialPort(mPortName, mBaudrate); mSerialPort.ReadTimeout = 50; if (!mSerialPort.IsOpen) { mSerialPort.Open(); } mNextReadFromTime = Time.time; } } }