// The Update function is responsible for monitoring the queue and executing requests void Update() { // If a request exists on the queue, and we're not busy servicing an earlier request, we service the next one on the queue. if (!toasting && requests.Count > 0) { ToastRequest new_request = requests.Dequeue(); toasting = true; instance.toast_text.text = new_request.message; instance.StartCoroutine(DoToast(instance.ease_duration, instance.show_duration)); } }