-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathWallController.cs
More file actions
51 lines (38 loc) · 1.42 KB
/
WallController.cs
File metadata and controls
51 lines (38 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using UnityEngine;
public class WallController : MonoBehaviour
{
public List<QuadTreeItem> QuadTreeItems = new List<QuadTreeItem>();
//public GameObject TextMeshPrefab = null;
//public UnityEngine.Object text = null;
public string StringToDisplay = string.Empty;
public GameObject parent = null;
GameObject wallTxt = null;
/*public WallController ()
{
}*/
void Start()
{
/*text = Instantiate(TextMeshPrefab, this.transform.position, Quaternion.identity);
parent.GetComponent<TextMesh>(). = text;*/
wallTxt = new GameObject("TextField");
wallTxt.transform.position = parent.transform.position + new Vector3(0.0f, 10.0f, 0.0f);
wallTxt.AddComponent<TextMesh>();
wallTxt.AddComponent<MeshRenderer>();
var meshRender = wallTxt.GetComponent<MeshRenderer>();
meshRender.material = (Material) Resources.Load("Arial");
wallTxt.GetComponent<TextMesh>().text = "Hello world";
var myFont = (Font) Resources.Load("Arial");
myFont.material.color = new Color(1.0f, 0.0f, 0.0f);
wallTxt.GetComponent<TextMesh>().font = myFont;
}
void Update()
{
//text.text = StringToDisplay;
List<string> str = new List<string>();
foreach (QuadTreeItem qi in QuadTreeItems)
str.Add(qi.name);
wallTxt.GetComponent<TextMesh>().text = String.Join(",", str.ToArray());
}
}