Skip to content

Commit

Permalink
Fix build report refreshing
Browse files Browse the repository at this point in the history
  • Loading branch information
oneVR committed Sep 23, 2020
1 parent cf9117a commit 42af8c0
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions Scripts/Editor/WorldDebugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2127,7 +2127,7 @@ private void RefreshBuild()
AssetDatabase.ImportAsset(LastBuildReportPath);
}

if (File.Exists(LastBuildReportPath) && !(File.Exists(WindowsBuildReportPath) || File.Exists(QuestBuildReportPath)))
if (File.Exists(LastBuildReportPath) && (!File.Exists(WindowsBuildReportPath) || !File.Exists(QuestBuildReportPath)))
{
switch (AssetDatabase.LoadAssetAtPath<BuildReport>(LastBuildReportPath).summary.platform)
{
Expand All @@ -2136,12 +2136,14 @@ private void RefreshBuild()
if (File.GetLastWriteTime(LastBuildReportPath) > File.GetLastWriteTime(WindowsBuildReportPath))
{
AssetDatabase.CopyAsset(LastBuildReportPath, WindowsBuildReportPath);
BuildReportWindows = (BuildReport)AssetDatabase.LoadAssetAtPath(WindowsBuildReportPath, typeof(BuildReport));
}
break;
case BuildTarget.Android:
if (File.GetLastWriteTime(LastBuildReportPath) > File.GetLastWriteTime(QuestBuildReportPath))
{
AssetDatabase.CopyAsset(LastBuildReportPath, QuestBuildReportPath);
BuildReportQuest = (BuildReport)AssetDatabase.LoadAssetAtPath(QuestBuildReportPath, typeof(BuildReport));
}
break;
default:
Expand Down Expand Up @@ -2238,6 +2240,16 @@ private void InitWhenNeeded()
m_TreeViewState = new TreeViewState();
}

if (BuildReportWindows is null && File.Exists(WindowsBuildReportPath))
{
BuildReportWindows = (BuildReport)AssetDatabase.LoadAssetAtPath(WindowsBuildReportPath, typeof(BuildReport));
}

if (BuildReportQuest is null && File.Exists(QuestBuildReportPath))
{
BuildReportQuest = (BuildReport)AssetDatabase.LoadAssetAtPath(QuestBuildReportPath, typeof(BuildReport));
}

var report = BuildReportWindows != null ? BuildReportWindows : BuildReportQuest;

m_TreeView = new BuildReportTreeView(m_TreeViewState, multiColumnHeader, report);
Expand All @@ -2252,6 +2264,8 @@ private void Refresh()
{
if (_recheck)
{
RefreshBuild();

//Check for bloat in occlusion cache
if (_occlusionCacheFiles == 0 && Directory.Exists("Library/Occlusion/"))
{
Expand Down Expand Up @@ -2284,7 +2298,6 @@ enum BuildReportType
private void OnGUI()
{
InitWhenNeeded();
RefreshBuild();
Refresh();

GUILayout.BeginHorizontal();
Expand Down

0 comments on commit 42af8c0

Please sign in to comment.