自定义Unity本地Debug

 1 using System;
 2 using System.IO;
 3 using System.Text;
 4 /// <summary>
 5 /// 自定义Unity本地Debug
 6 /// </summary>
 7 public class MyDebug {
 8 
 9     private static string path = @"C:/MyDebug.txt";
10     public static void Log(string infor)
11     {
12         if (!File.Exists(path))
13         {
14             File.Create(path);
15         }
16         FileStream fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write);
17         StreamWriter sw = new StreamWriter(fs);
18         sw.WriteLine(infor + " " + DateTime.Now);
19         sw.Close();
20         sw.Dispose();
21         fs.Close();
22         fs.Dispose();
23     }
24 }

记录信息存储在本地,方便查看

 

转载请注明地址:http://www.cnblogs.com/Vincentblogs/p/4083028.html

QQ群:346738352 Unity技术交流群,讲纯粹的技术。 

posted @ 2014-11-07 20:03  Think_From_Code  阅读(398)  评论(0编辑  收藏  举报