void Update()
{
//print ("Serial Update");
if (s_serial != null && s_serial.IsOpen) {
if (nCoroutineRunning == 0) {
//print ("starting ReadSerialLoop coroutine");
switch (Application.platform) {
case RuntimePlatform.WindowsEditor:
case RuntimePlatform.WindowsPlayer:
case RuntimePlatform.WindowsWebPlayer:
s_serial.ReadTimeout = 1;
// Each instance has its own coroutine but only one will be active
StartCoroutine (ReadSerialLoopWin ());
break;
default:
// Each instance has its own coroutine but only one will be active
StartCoroutine (ReadSerialLoop ());
break;
}
} else {
if (nCoroutineRunning > 1)
print (nCoroutineRunning + " coroutines in " + name);
nCoroutineRunning = 0;
}
}
}