Guest User

Untitled

a guest
Feb 5th, 2017
286
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class Dialogue : MonoBehaviour {
  7. // variables
  8. public Text dialogueText;
  9. public string message = "";
  10.  
  11. void Start()
  12. {
  13. dialogueText = GameObject.Find("MessageText").GetComponent<Text>();
  14. }
  15. void OnTriggerEnter(Collider other)
  16. {
  17. if (other.tag == "Player")
  18. {
  19. dialogueText.text = message;
  20. }
  21. }
  22.  
  23. void OnTriggerExit(Collider other)
  24. {
  25. if (other.tag == "Player")
  26. {
  27. dialogueText.text = "";
  28. }
  29. }
  30. }
RAW Paste Data