简单的日志输出

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 += "
" + info;
    }

    private void Clear()
    {
        log.text = "Log:";
    }

    void Start ()
    {
        theLogger = this;
        log = GetComponent<Text>();
        log.text = "Log:";
        GetComponentInChildren<Button>().onClick.AddListener(Clear);
    }

}
原文地址:https://www.cnblogs.com/llstart-new0201/p/9417382.html