-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebugOnScreen.cs
More file actions
36 lines (31 loc) · 1.02 KB
/
Copy pathdebugOnScreen.cs
File metadata and controls
36 lines (31 loc) · 1.02 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
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
using TM.Utils;
public class debugOnScreen : MonoBehaviour
{
private string newline = "\r\n";
public Text textPanel;
void Update()
{
if (textPanel != null) {
string message = "";
textPanel.text = "";
Dictionary<string, MessageLog>msgs = debugLog.instance.messageLog;
var ordered = msgs.OrderBy(x => x.Value.category);
string cat = "";
foreach(KeyValuePair<string, MessageLog> entry in ordered)
{
if ( cat != entry.Value.category) {
cat = entry.Value.category;
message += ("<b>"+cat+"</b>"+newline);
}
string msg = " " + entry.Value.name + ": " + entry.Value.text;
message += (msg+newline);
}
textPanel.text = message;
}
}
}