Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEngine.UI;
- public class ButtonClicky : MonoBehaviour
- {
- public Text TextLabelGO;
- private string[] dialogStrings = new string[4];
- private int currentLineNumber = 0;
- void Start()
- {
- // a list of our strings to display, can also make public to edit in inspector
- dialogStrings[0] = "Line 1 Text goes in here";
- dialogStrings[1] = "Line 2 Text goes in here";
- dialogStrings[2] = "Line 3 Text goes in here";
- dialogStrings[3] = "Line 4 Text goes in here";
- // Assign the current dialog string to our text object
- TextLabelGO.text = dialogStrings[currentLineNumber];
- }
- public void AdvanceText()
- {
- // advance the current line number to the next one to display
- currentLineNumber++;
- // and update our text object with the new string to show
- TextLabelGO.text = dialogStrings[currentLineNumber];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement