void OnGUI() { var position = Camera.main.WorldToScreenPoint(character.transform.position); var textSize = GUI.skin.label.CalcSize(new GUIContent(text)); if (triggered) //The dialogue starts. { if (isTalkedTo == false) { text = "Press Enter to talk!"; GUI.contentColor = Color.black; GUI.Label(new Rect(position.x - 55, position.y - 60, textSize.x, textSize.y), text); } else if (isTalkedTo == true) { if (Input.GetKeyUp("space")) { if (i < missionBriefinglength - 1) { i = i + 1; } } text = characterName + ": " + messages[i]; GUI.contentColor = Color.black; GUI.Label(new Rect(10, 400, textSize.x, textSize.y), text); } if (Input.GetKeyDown("return") && isTalkedTo == false) { isTalkedTo = true; } else if (Input.GetKeyDown("backspace") && isTalkedTo == true) { i = 0; isTalkedTo = false; if (doesFollow) { willFollow = true; pc.incPeopleInGroup(); int price = bc.getPrice(); int newPrice = price * pc.getPeopleInGroup(); Debug.Log("Current price of bus tickets as they should be: " + newPrice); bc.setPrice(newPrice); Debug.Log(pc.getPeopleInGroup() + " : " + newPrice); } } } }