首页 > 其他 > 详细

简单的日志输出

时间:2018-08-04 10:46:41      阅读:306      评论:0      收藏:0      [点我收藏+]

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);
    }

}

 

简单的日志输出

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!