Skip to content

Commit

Permalink
编辑器下,打开Profiler窗口才进行profiler
Browse files Browse the repository at this point in the history
  • Loading branch information
ale committed Jan 13, 2023
1 parent 1364786 commit ee6f0ae
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class LuaProfilerWindow : EditorWindow
100000
}
);

private static LuaProfilerTreeView m_TreeView;
SearchField m_SearchField;
int startFrame = 0;
Expand Down Expand Up @@ -166,7 +166,7 @@ void OnEnable()
}

m_SearchField = new SearchField();

LuaDeepProfilerSetting.Instance.ProfilerWinOpen = true;
LuaProfilerTreeView.m_nodeDict.Clear();
startFrame = 0;
endFrame = 0;
Expand Down Expand Up @@ -220,6 +220,7 @@ private void OnDisable()
powrChart = null;
Destory(boxTex);
boxTex = null;
LuaDeepProfilerSetting.Instance.ProfilerWinOpen = false;
EditorApplication.update -= m_TreeView.DequeueSample;
EditorApplication.update -= m_luaRefScrollView.DequeueLuaInfo;
}
Expand Down
16 changes: 16 additions & 0 deletions LuaProfiler/Runtime/Common/Setting/LuaDeepProfilerSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ public static LuaDeepProfilerSetting Instance

#endregion

public bool ProfilerWinOpen {
get
{
return m_profilerWinOpen;
}
set
{
if (m_profilerWinOpen != value)
{
m_profilerWinOpen = value;
Save();
}
} }

public bool m_profilerWinOpen= false;

public bool isDeepLuaProfiler
{
get
Expand Down
12 changes: 12 additions & 0 deletions LuaProfiler/Runtime/Core/LuaHookSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ public static void OnStartGame()

if (setting.isDeepLuaProfiler || !setting.isLocal)
{
#if UNITY_EDITOR
if (!setting.ProfilerWinOpen)
{
return;
}
#endif
Debug.Log("<color=#00ff00>OnStartGame</color>");
LuaDLL.Uninstall();
IntPtr LuaModule = LuaDLL.CheckHasLuaDLL();
Expand All @@ -110,6 +116,12 @@ public static void OnStartGame()

if (setting.isDeepLuaProfiler || setting.isCleanMode || !setting.isLocal)
{
#if UNITY_EDITOR
if (!setting.ProfilerWinOpen)
{
return;
}
#endif
GameObject go = new GameObject();
go.name = "MikuLuaProfiler";
go.hideFlags = HideFlags.HideAndDontSave;
Expand Down

0 comments on commit ee6f0ae

Please sign in to comment.