91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-03
  • 語言: 其他
  • 標簽: unity??

資源簡介

Unity的debug輸出顯示在游戲場景Game ;Unity的debug輸出顯示在游戲場景中

資源截圖

代碼片段和文件信息

using?UnityEngine;
using?System.Collections;
using?System.Collections.Generic;

public?class?DebugConsole?:?MonoBehaviour
{?
????private?static?DebugConsole?instance?=?null;?
????public?class?Log
????{
????????public?string?msg;
????????public?string?stacktrace;
????????public?LogType?type;
????????public?Log(string?msg?string?stacktrace?LogType?type)
????????{
????????????this.msg?=?msg;
????????????this.stacktrace?=?stacktrace;
????????????this.type?=?type;
????????}
????}
????
????static?readonly?Dictionary?logTypeColors?=?new?Dictionary
????????{
????????????{?LogType.Assert?Color.white?}
????????????{?LogType.Error?Color.red?}
????????????{?LogType.Exception?Color.red?}
????????????{?LogType.Log?Color.white?}
????????????{?LogType.Warning?Color.yellow?}
????????};

????private?double?lastInterval?=?0.0;
????private?int?frames?=?0;
????private?float?m_fps;
????private?float?m_accumTime?=?0;
????private?float?m_fpsUpdateInterval?=?0.5f;

????private?string?strFPS;
????private?string?strMem;

????private?List?m_logs?=?new?List();
????private?Vector2?scrollPosition?=?Vector2.zero;
????private?bool?m_logEnabled?=?true;


????void?Awake()
????{
????????if?(instance?==?null)
????????{
????????????instance?=?this;
????????????DontDestroyonload(gameobject);
????????}
????}

????void?Start()
????{
????????lastInterval?=?Time.realtimeSinceStartup;
????????frames?=?0;
????}

????void?HandleLog(string?msg?string?stacktrace?LogType?type)
????{

????????if?(!m_logEnabled)
????????{
????????????return;
????????}



????????//if?(type?==?LogType.Assert?||?type?==?LogType.Error?||?type?==?LogType.Exception)?{
????????m_logs.Add(new?Log(msg?stacktrace?type));
????????//}

????????scrollPosition.y?=?float.MaxValue;
????}

????void?OnEnable()
????{
????????Application.logMessageReceived?+=?HandleLog;
????}

????void?OnDisable()
????{
????????Application.logMessageReceived?-=?HandleLog;
????}

????//?Update?is?called?once?per?frame
????void?Update()
????{
????????++frames;

????????float?timeNow?=?Time.realtimeSinceStartup;
????????if?(timeNow?-?lastInterval?>?m_fpsUpdateInterval)
????????{
????????????float?fps?=?frames?/?(float)(timeNow?-?lastInterval);
????????????float?ms?=?1000.0f?/?Mathf.Max(fps?0.0001f);
????????????strFPS?=?string.Format(“{0}?ms?{1}FPS“?ms.ToString(“f1“)?fps.ToString(“f2“));
????????????frames?=?0;
????????????lastInterval?=?timeNow;
????????}

????????//?system?info
????????if?(Time.frameCount?%?30?==?0)
????????{
????????????strMem?=?string.Format(“memory?:?{0}?MB“?System.GC.GetTotalMemory(false)?/?(1024?*?1024));
????????}
????}


????void?OnGUI()
????{


????????GUI.skin.label.fontSize?=?24;?
????????GUI.skin.button.fontSize?=?24;
????????GUI.skin.button.margin?=?new?RectOffset(20?10?10?10);

????????GUILayout.Label(strFPS);
????????//GUILayout.Label?(strM

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????4213??2017-12-05?15:29??DebugConsole.cs

評論

共有 條評論