diff --git a/Assets/Scripts/Framework/EditiorContent/EditorController.cs b/Assets/Scripts/Framework/EditiorContent/EditorController.cs index 30f72ae..e6215bc 100644 --- a/Assets/Scripts/Framework/EditiorContent/EditorController.cs +++ b/Assets/Scripts/Framework/EditiorContent/EditorController.cs @@ -16,7 +16,7 @@ namespace Demo.Editor { public class EditorController : MonoSingleton { -#if UNITY_EDITOR +#if UNITY_EDITOR||Using_ProfilerMarker public ProfilerMarker s_PreparePerfMarker = new(nameof(EditorController) + "Runtime"); #endif @@ -467,7 +467,7 @@ namespace Demo.Editor { CurrentFPS.text = $"{1 / Time.smoothDeltaTime}"; -#if UNITY_EDITOR +#if UNITY_EDITOR||Using_ProfilerMarker s_PreparePerfMarker.Begin(this); try { @@ -530,7 +530,7 @@ namespace Demo.Editor CloseCurrentProject(); } } -#if UNITY_EDITOR +#if UNITY_EDITOR||Using_ProfilerMarker } finally { diff --git a/Assets/Scripts/Framework/GameContent/GameController.cs b/Assets/Scripts/Framework/GameContent/GameController.cs index 21560ba..b821e53 100644 --- a/Assets/Scripts/Framework/GameContent/GameController.cs +++ b/Assets/Scripts/Framework/GameContent/GameController.cs @@ -278,8 +278,10 @@ 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() { @@ -293,15 +295,21 @@ 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); } if (IsMain == false) return; +#if UNITY_EDITOR || Using_ProfilerMarker s_PreparePerfMarker.Begin(this); +#endif #if UNITY_EDITOR if (Keyboard.current[Key.LeftShift].isPressed) #else @@ -348,7 +356,9 @@ namespace Demo.Game } } } +#if UNITY_EDITOR||Using_ProfilerMarker s_PreparePerfMarker.End(); +#endif } public IEnumerator GameExit() diff --git a/Assets/Scripts/Framework/ScriptableObject.cs b/Assets/Scripts/Framework/ScriptableObject.cs index a8946d8..5b30186 100644 --- a/Assets/Scripts/Framework/ScriptableObject.cs +++ b/Assets/Scripts/Framework/ScriptableObject.cs @@ -642,12 +642,16 @@ namespace Demo /// public partial class ScriptableObject { - private bool isEnableScript = false; + public string SourcePath = ""; + public string ScriptName = ""; + public string ScriptPath; + public string ScriptTypename; + public void EnableScript(string sourcePath, string scriptPath, string scriptType, ScriptableObject parent) { -#if UNITY_EDITOR||true +#if UNITY_EDITOR||Using_ProfilerMarker s_PreparePerfMarker = new(ScriptName); #endif if (isEnableScript) @@ -690,6 +694,15 @@ namespace Demo } } + /// + /// 脚本解析与Update执行 + /// + public partial class ScriptableObject + { + + + } + /// /// 使用标记可编辑脚本所能够调用的函数,并附加注释 /// 使用标记派生类,并附加默认模板 @@ -700,12 +713,7 @@ namespace Demo public static Dictionary FastScriptableObjectTypen = new(); public static bool IsAutoPlay = false; - public string SourcePath = ""; - public string ScriptName = ""; - public string ScriptPath; - public string ScriptTypename; - -#if UNITY_EDITOR||true +#if UNITY_EDITOR||Using_ProfilerMarker public ProfilerMarker s_PreparePerfMarker; #endif public ScriptableObject Parent; @@ -861,7 +869,7 @@ namespace Demo return DoLoadSubScriptAsync(type, path, null); } - + /* /// /// 异步加载子脚本 /// @@ -878,6 +886,7 @@ namespace Demo { StartCoroutine(DoLoadSubScriptAsync(type, path, null)); } + */ private enum ParseStats { @@ -1147,7 +1156,7 @@ namespace Demo return; if (gameObject.activeInHierarchy == false) return; -#if UNITY_EDITOR||true +#if UNITY_EDITOR||Using_ProfilerMarker s_PreparePerfMarker.Begin(this); #endif if (tickType == TickType.Reset) @@ -1166,7 +1175,7 @@ namespace Demo { child.ScriptUpdate(currentTime, deltaTime, tickType); } -#if UNITY_EDITOR||true +#if UNITY_EDITOR||Using_ProfilerMarker s_PreparePerfMarker.End(); #endif } diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 9a10787..8c416b9 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -960,7 +960,7 @@ PlayerSettings: QNX: UNITY_POST_PROCESSING_STACK_V2;UNITY_VISUAL_SCRIPTING Server: UNITY_VISUAL_SCRIPTING Stadia: UNITY_POST_PROCESSING_STACK_V2 - Standalone: ODIN_INSPECTOR;ODIN_INSPECTOR_3;ODIN_INSPECTOR_3_1;ODIN_VALIDATOR;ODIN_VALIDATOR_3_1;PLATFORM_WINDOWS;DREAMTECK_SPLINES;UNITY_POST_PROCESSING_STACK_V2;UNITY_VISUAL_SCRIPTING + Standalone: ODIN_INSPECTOR;ODIN_INSPECTOR_3;ODIN_INSPECTOR_3_1;ODIN_VALIDATOR;ODIN_VALIDATOR_3_1;PLATFORM_WINDOWS;DREAMTECK_SPLINES;UNITY_POST_PROCESSING_STACK_V2;UNITY_VISUAL_SCRIPTING;ENABLE_CLASS_Interaction VisionOS: UNITY_POST_PROCESSING_STACK_V2;UNITY_VISUAL_SCRIPTING WebGL: UNITY_POST_PROCESSING_STACK_V2;UNITY_VISUAL_SCRIPTING;DREAMTECK_SPLINES;ODIN_VALIDATOR;ODIN_VALIDATOR_3_1;ODIN_INSPECTOR;ODIN_INSPECTOR_3;ODIN_INSPECTOR_3_1 Windows Store Apps: UNITY_VISUAL_SCRIPTING