Unity全局日志

注释

在打包完成了测试不方便,我们可以把打印信息存在文本里,然后可以再运行打包程序的时候可以查看

cpp 复制代码
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;


public class DebugToCall
{
    public static string path = "D:\\Log.txt";

    public static void Log(string log)
    {
        FileStream file;
        if (!File.Exists(path))
        {
            file = File.Create(path);
        }
        else
        {
            file = File.Open(path,FileMode.Open);
        }

        file.Dispose();
        UnityEngine.Debug.Log(log);
        File.AppendAllText(path, log + "\r", Encoding.UTF8);
        file.Close();
    }
}
相关推荐
Hx_Ma162 分钟前
前台模块以及分页逻辑
java·开发语言
亓才孓6 分钟前
AspectJ和SpringAOP的区别
java·开发语言
大鹏说大话8 分钟前
破局单体瓶颈:SQLParser 解析器的分层架构重构实战
开发语言
tod11311 分钟前
C++ 核心知识点全解析(八)
开发语言·c++·面试经验
Ljwuhe14 分钟前
C++类与对象(上)
开发语言·c++
十启树16 分钟前
QGis开发环境部署
开发语言·gis·qgis
亚比囧25 分钟前
Java基础--面向对象(二)
java·开发语言
乐观勇敢坚强的老彭32 分钟前
c++寒假营day05
开发语言·c++·算法
枫叶丹434 分钟前
【Qt开发】Qt界面优化(七)-> Qt样式表(QSS) 样式属性
c语言·开发语言·c++·qt
重生之后端学习40 分钟前
74. 搜索二维矩阵
开发语言·数据结构·算法·职场和发展·深度优先