Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class DynamicSpawner2 : MonoBehaviour {
- public TextAsset textFile;
- public string[] textLines;
- public GameObject platform;
- private TextMesh linesMesh;
- // Use this for initialization
- void Start () {
- linesMesh = platform.GetComponent<TextMesh>();
- Spawn();
- if (textFile != null)
- {
- textLines = textFile.text.Split('\n');
- }
- foreach(string StringLine in textLines)
- {
- linesMesh.text = StringLine;
- }
- }
- public void Spawn()
- {
- Instantiate(platform, transform.position, Quaternion.identity);
- Invoke("Spawn", 1f);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement