添加Tracy0.11的性能分析支持

This commit is contained in:
2025-11-27 17:18:30 +08:00
parent 92c5c7f795
commit 0d856db69a
56 changed files with 4045 additions and 505 deletions

View File

@@ -1,10 +1,9 @@
using Cinemachine;
using Convention;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using Cinemachine;
using Convention;
using Unity.Profiling;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
@@ -296,11 +295,6 @@ namespace Demo.Game
private bool IsScrollTimeline = false;
#if UNITY_EDITOR||Using_ProfilerMarker
public ProfilerMarker s_PreparePerfMarkerForSetSongCurrentTime = new(nameof(GameController) + "RuntimeForSetSongCurrentTime");
public ProfilerMarker s_PreparePerfMarker = new(nameof(GameController) + "Runtime");
#endif
private void Update()
{
CurrentTime = MainAudio.CurrentTime + SongOffset;
@@ -313,23 +307,23 @@ namespace Demo.Game
// TODO : 修正这个逻辑,这个逻辑是反常的
if (MainAudio.IsPlaying())
{
#if UNITY_EDITOR||Using_ProfilerMarker
s_PreparePerfMarkerForSetSongCurrentTime.Begin();
#endif
SetSongCurrentTime(CurrentTime);
#if UNITY_EDITOR||Using_ProfilerMarker
s_PreparePerfMarkerForSetSongCurrentTime.End();
#endif
MainObject.ScriptUpdate(CurrentTime, deltaTime, ScriptableObject.TickType.Update);
using (Profiler.BeginZone("GameController.SetSongCurrentTime"))
{
SetSongCurrentTime(CurrentTime);
}
using (Profiler.BeginZone("GameController.ScriptUpdate"))
{
MainObject.ScriptUpdate(CurrentTime, deltaTime, ScriptableObject.TickType.Update);
}
}
if (IsMain == false)
return;
#if UNITY_EDITOR || Using_ProfilerMarker
s_PreparePerfMarker.Begin(this);
#endif
using (Profiler.BeginZone("GameController.InputHandling"))
{
#if UNITY_EDITOR
if (Keyboard.current[Key.LeftShift].isPressed)
if (Keyboard.current[Key.LeftShift].isPressed)
#else
if (Keyboard.current[Key.LeftCtrl].isPressed)
#endif
@@ -374,9 +368,7 @@ namespace Demo.Game
}
}
}
#if UNITY_EDITOR||Using_ProfilerMarker
s_PreparePerfMarker.End();
#endif
}
}
public IEnumerator GameExit()