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();
    }
}
相关推荐
玖玥拾5 小时前
Unity Shader 基础与图形学(一)
unity·图形渲染·图形学·shader
君顾17 小时前
上海24小时自助健身房系统开发实战指南:从架构设计到落地部署
java·开发语言·健身房
香菜TTT7 小时前
大模型上下文协议(MCP):AI 应用的“USB-C”接口技术
开发语言·人工智能·经验分享
aramae8 小时前
模拟实现strlen()函数 (C语言)
c语言·开发语言·后端
jimy19 小时前
readelf 查看“派生类”的vtable符号
开发语言·c++
ctlover9 小时前
排序与查找算法详解
开发语言·python
YYYing.9 小时前
【C++进阶系列 (七)】C++ RTTI 深度剖析:从 typeid 到 dynamic_cast 的底层之旅
开发语言·c++·c/c++·rtti
nvvas11 小时前
Java 入门(四):数组——数据的集合管理
java·开发语言
Y38153266211 小时前
SERP 数据清洗实战:字段标准化、日期解析与去重键
开发语言·数据库·python·python数据库
君顾112 小时前
本地城市低空经济管理系统定制:城市级低空运营平台架构与落地实战
java·开发语言·飞手