一.AFLogger

首先介绍一下Debug的设置
image.png
输出模式总共有 :
image.png

NoDebug 调用AFLogger里函数的日志将都不会输出
NormalDebug 调用AFLogger里函数的日志将都正常输出
EditorDebug 调用AFLogger里函数的日志只会在Editor环境中输出
TXTFileDebug 调用AFLogger和Debug里函数的日志会输出到一个txt文件,文件路径为Application.persistentDataPath/文件名.txt
CSVFileDebug 调用AFLogger和Debug里函数的日志会输出到一个csv文件,文件路径为Application.persistentDataPath/文件名.csv
JsonFileDebug 调用AFLogger和Debug里函数的日志会输出到一个json文件,文件路径为Application.persistentDataPath/文件名.json

二.File Debug

File Debug是对AFLogger的扩展,参考仓库 : https://github.com/Sacred-Seed-Studio/Unity-File-Debug
image.png

这个仓库挺好的,之所以还保留之前的AFLogger是因为有些项目打上线包时可能需要一键屏蔽掉所有的日志,更改APPinfo的DebugMode配置即可
AFLogger也封装了启动File Debug,但是这是统一的,不建议使用

三.单独使用File Debug

1.挂载UnityFileDebug脚本

2.初始化,类似:

  1. _unityFileDebug.FileDebugInit(FileDebugName,FileType.CSV);