-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogger.cs
36 lines (32 loc) · 797 Bytes
/
Logger.cs
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 UnityEngine;
public class Logger : MonoBehaviour
{
public static Logger Instance;
public delegate void StringDelegate(string info);
public static StringDelegate LogHandler;
// Start is called before the first frame update
void Awake()
{
if (Instance == null)
{
Instance = this;
LogHandler += Debug.Log;
}
else
{
Debug.Log("Logger already Instanced, Will Destroy: " + name);
Destroy(gameObject);
}
}
// Update is called once per frame
void Update()
{
}
public static void Log(object info)
{
if (LogHandler != null)
LogHandler(info.ToString());
}
}