简单的日志输出
unity打包测试时,不会有控制台输出日志,所以简单一个日志输出脚本
using UnityEngine; using UnityEngine.UI; public class LogInfo : MonoBehaviour { public bool isDebug = true; private Text log; public static LogInfo theLogger; public void Log(string info) { if(isDebug) log.text += "\r\n" + info; } private void Clear() { log.text = "Log:"; } void Start () { theLogger = this; log = GetComponent<Text>(); log.text = "Log:"; GetComponentInChildren<Button>().onClick.AddListener(Clear); } }