using System.Collections; using System.Collections.Generic; using UnityEngine; using System; namespace BF { public class ShowDebugText : MonoBehaviour { private string debugText = ""; private Func luaCallback; public void AddCallback(Func func) { luaCallback = func; } public void RemoveCallback() { luaCallback = null; debugText = ""; } void OnGUI() { GUIStyle s = new GUIStyle(); s.normal.textColor = new Color(255, 0, 0); s.fontSize = 40; GUI.Label(new Rect(0, 0, 200, 200), debugText, s); } void Update() { if(luaCallback != null) { debugText = luaCallback(); } } } }