Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3.  
  4. public class ButtonClicky : MonoBehaviour
  5. {
  6.     public Text TextLabelGO;
  7.  
  8.     private string[] dialogStrings = new string[4];
  9.     private int currentLineNumber = 0;
  10.  
  11.     void Start()
  12.     {
  13.         // a list of our strings to display, can also make public to edit in inspector
  14.         dialogStrings[0] = "Line 1 Text goes in here";
  15.         dialogStrings[1] = "Line 2 Text goes in here";
  16.         dialogStrings[2] = "Line 3 Text goes in here";
  17.         dialogStrings[3] = "Line 4 Text goes in here";
  18.  
  19.         // Assign the current dialog string to our text object
  20.         TextLabelGO.text = dialogStrings[currentLineNumber];
  21.     }
  22.  
  23.     public void AdvanceText()
  24.     {
  25.         // advance the current line number to the next one to display
  26.         currentLineNumber++;
  27.  
  28.         // and update our text object with the new string to show
  29.         TextLabelGO.text = dialogStrings[currentLineNumber];
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement