public void Speak(string lineToSpeak, float onScreenDuration) { Vector3 positionAdjustment = new Vector3(indicatorLight.GetComponent <SpriteRenderer>().bounds.size.x / 2f, indicatorLight.GetComponent <SpriteRenderer>().bounds.size.y / 1f, 0f); Vector3 screenPos = Camera.main.WorldToScreenPoint(indicatorLight.transform.position + positionAdjustment); GameObject newTextBox = Instantiate(textBoxPrefab); newTextBox.transform.SetParent(GameObject.Find("Canvas").transform); newTextBox.GetComponent <RectTransform>().localScale = Vector3.one; newTextBox.GetComponent <RectTransform>().position = screenPos; newTextBox.GetComponentInChildren <Text>().text = lineToSpeak; TextBoxController newTextBoxCont = newTextBox.GetComponent <TextBoxController>(); newTextBoxCont.displayDuration = onScreenDuration; newTextBoxCont.borderCol = curSpeaker.color; newTextBoxCont.Grow(); curTextBox = newTextBox; //Destroy(newTextBox, onScreenDuration); }