// Use this for initialization void Start() { beenTriggered = false; canBeTrigerred = false; dialogueBoxOpen = false; screenWidth = Screen.width; //is 1336 when the window is fullscreen screenHeight = Screen.height; textSize = 20 * (screenWidth / 1336); dialogueSkin.box.fontSize = (int)textSize; txt = (TextAsset)Resources.Load("TextResources/" + fileName, typeof(TextAsset)); theWholeTextFile = txt.text; //parse the file. linesFromtxtFile = theWholeTextFile.Split('\n'); // read this array into trigName, speaker, and dialogue int i = 0; while (i + 2 < linesFromtxtFile.Length) { trigName.Add(linesFromtxtFile[i]); i++; speaker.Add(linesFromtxtFile[i]); i++; dialogue.Add(linesFromtxtFile[i]); i++; } /////GET THE DIALOGUE BOX ELEMENTS OF THE CANVAS dialogueBox = GameObject.FindGameObjectWithTag("Canvas").transform.FindChild("DialogueBox").gameObject; dialogueBox.SetActive(false); speakerBox = dialogueBox.transform.FindChild("SpeakerPic").gameObject; dialogueHolder = dialogueBox.transform.FindChild("TextHolder").FindChild("Dialogue").gameObject; dialogueText = dialogueHolder.transform.GetComponent <Text>(); speakerPic = speakerBox.transform.GetComponent <RawImage>(); //speakerPic.texture = drFrizPic; //dialogueText.text = "The text is hello world"; //this pushes the text into box to make toom for the picture dialogueSkin.box.padding.left = (int)(0.2f * screenHeight); }