using UnityEngine;using System.Collections;using System.Collections.Generic;using System.IO;using System.Text;using System;using System.Net.Sockets;public class ULog : MonoBehaviour{ static List mLines = new List(); static List mWriteTxt = new List(); private string outpath; /// /// 是否输出日志到界面上 /// public bool isOutputScreen = true; /// /// 是否记录日志 /// static public bool IsDebug = true; //------------------scroll view-------------- public Vector2 scrollPosition = Vector2.zero; public float scrollVelocity = 0f; public float timeTouchPhaseEnded = 0f; public float inertiaDuration = 0.5f; public Vector2 lastDeltaPos; //------------------------------------------- void Start() { //Application.persistentDataPath Unity中只有这个路径是既可以读也可以写的。 if (Application.platform == RuntimePlatform.WindowsEditor) { outpath = Application.dataPath + "/UnityLog.txt"; } else//android { outpath = Application.persistentDataPath + "/UnityLog.txt"; } //每次启动客户端删除之前保存的Log if (System.IO.File.Exists(outpath)) { File.Delete(outpath); } //在这里做一个Log的监听 Application.logMessageReceived += HandleLog; } /// /// 记录日志 /// /// #if UNITY_EDITOR public static Action