public static bool autoConnect(float time) { int tmp = -3; while (!BtConnector.isConnected() && time > 0) { time -= Time.deltaTime; if (tmp == -3) { BtConnector.connect(); } tmp = BtConnector.controlData(); } return(BtConnector.isConnected()); }