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();
    }
}
相关推荐
diegoXie2 小时前
Python / R 向量顺序分割与跨步分割
开发语言·python·r语言
程序员小白条2 小时前
0经验如何找实习?
java·开发语言·数据结构·数据库·链表
liulilittle2 小时前
C++ 浮点数封装。
linux·服务器·开发语言·前端·网络·数据库·c++
失散133 小时前
Python——1 概述
开发语言·python
萧鼎3 小时前
Python 图像哈希库 imagehash——从原理到实践
开发语言·python·哈希算法
小小8程序员3 小时前
STL 库(C++ Standard Template Library)全面介绍
java·开发语言·c++
立志成为大牛的小牛3 小时前
数据结构——五十六、排序的基本概念(王道408)
开发语言·数据结构·程序人生·算法
老王熬夜敲代码3 小时前
C++中的atomic
开发语言·c++·笔记·面试
a努力。4 小时前
腾讯Java面试被问:String、StringBuffer、StringBuilder区别
java·开发语言·后端·面试·职场和发展·架构
长安第一美人4 小时前
php出现zend_mm_heap corrupted 或者Segment fault
开发语言·嵌入式硬件·php·zmq·工业应用开发