Advertisement
tomicz

Untitled

Jun 18th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class DynamicSpawner2 : MonoBehaviour {
  5.  
  6. public TextAsset textFile;
  7. public string[] textLines;
  8. public GameObject platform;
  9. private TextMesh linesMesh;
  10.  
  11. // Use this for initialization
  12. void Start () {
  13.  
  14. linesMesh = platform.GetComponent<TextMesh>();
  15. Spawn();
  16.  
  17. if (textFile != null)
  18. {
  19. textLines = textFile.text.Split('\n');
  20. }
  21.  
  22. foreach(string StringLine in textLines)
  23. {
  24. linesMesh.text = StringLine;
  25. }
  26.  
  27. }
  28.  
  29.  
  30.  
  31. public void Spawn()
  32. {
  33. Instantiate(platform, transform.position, Quaternion.identity);
  34. Invoke("Spawn", 1f);
  35. }
  36.  
  37.  
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement