Skip to content

Commit

Permalink
Update BuildReportInspector.cs
Browse files Browse the repository at this point in the history
Pulled out array allocation in loop
  • Loading branch information
ryanc-unity authored Nov 28, 2022
1 parent 0c8ed1f commit 66d9d40
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions com.unity.build-report-inspector/Editor/BuildReportInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -648,12 +648,18 @@ private void DisplayAssetsView(float vPos)

private void OnOutputFilesGUI()
{
if (report.GetFiles().Length == 0)
#if UNITY_2022_1_OR_NEWER
var files = report.GetFiles();
#else
var files = report.files;
#endif // UNITY_2019_3_OR_NEWER

if (files.Length == 0)
return;

var longestCommonRoot = report.GetFiles()[0].path;
var longestCommonRoot = files[0].path;
var tempRoot = Path.GetFullPath("Temp");
foreach (var file in report.GetFiles())
foreach (var file in files)
{
if (file.path.StartsWith(tempRoot))
continue;
Expand All @@ -666,7 +672,7 @@ private void OnOutputFilesGUI()
}
}
var odd = false;
foreach (var file in report.GetFiles())
foreach (var file in files)
{
if (file.path.StartsWith(tempRoot))
continue;
Expand Down

0 comments on commit 66d9d40

Please sign in to comment.