SHARE
TWEET

Untitled

tomicz Jun 18th, 2016 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top