void updateDialog() { while (objects.Count > 0 && !dialogBox.gameObject.activeSelf) { ManagerObject newSpawningObject = objects.Dequeue(); if (newSpawningObject.GetType().Name.Equals("Dialog")) { dialogBox.gameObject.SetActive(true); currentDialog = (Dialog)newSpawningObject; dialogText.text = currentDialog.text; dialogText.color = currentDialog.color; Time.timeScale = 0f; } else { Prefab dequeuedPrefab = (Prefab)newSpawningObject; GameObject spawnedPrefab = Instantiate(dequeuedPrefab.prefab); spawnedPrefab.transform.position = dequeuedPrefab.position; } } }