private IEnumerator ProcessRequestLoop() { bool _foundRequest = false; string _rType = ""; if (RequestQueue.Count > 0) { _foundRequest = true; Request r = RequestQueue.Dequeue(); Debug.Log("Starting new request: " + r.type.ToString()); _rType = r.type.ToString(); switch (r.type) { case RequestType.Add: yield return(StartCoroutine(Instance.AddEntryToDatabase(r.word, r.emotionIdeal, r.boolResult))); yield return(new WaitForSeconds(IN_BETWEEN_WAIT)); break; case RequestType.Contains: yield return(StartCoroutine(Instance.DatabaseContains(r.word, r.boolResult))); yield return(new WaitForSeconds(IN_BETWEEN_WAIT)); break; case RequestType.Get: yield return(StartCoroutine(Instance.GetWord(r.word, r.wordEmoIdealResult))); yield return(new WaitForSeconds(IN_BETWEEN_WAIT)); break; } } if (_foundRequest) { Debug.Log("Finished request: " + _rType); } yield return(null); StartCoroutine("ProcessRequestLoop"); }