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();
    }
}
相关推荐
深念Y5 小时前
为什么选 Go:直观、可维护、AI 友好
linux·开发语言·人工智能·golang·agent·harness
Billy121386 小时前
Day25-编译期计算与 constexpr if:跨越编译与运行的边界
开发语言·c++进阶学习
小小龙学IT6 小时前
第七节 C++ 与 QML 交互
开发语言·qt
晓晓_za8986686 小时前
Geo 优化源码二次开发:自定义地域规则改造实操文档
java·开发语言·搜索引擎·ci/cd·矩阵
ShineWinsu7 小时前
对于TRAE中配置Qt的解析
开发语言·c++·ide·vscode·qt·ai·trae
wy3136228217 小时前
Git——ignore让项目的 target 目录真正被忽略(忽略其他文件也是同样的道理)
开发语言·git
格林威7 小时前
C#图像分块处理:图像按行或按块(Tile)切分,多个 CPU 核心同时处理不同的区域
开发语言·图像处理·人工智能·机器学习·计算机视觉·c#·工业相机
leisoo80977 小时前
财报舞弊预警系统实战用Python挖掘应收存货异常因子 IG50免费开源股票数据API接口
开发语言·python
君顾17 小时前
AI新零售线上商城系统实战:架构设计与开发全流程指南
java·开发语言·零售
wind100327 小时前
Outdated Visual C++ Redistributable 过时 VC++ 运行库报错修复
开发语言·c++