From b2e6ed7467d20c20bfcfe9bb719453dc66e7e894 Mon Sep 17 00:00:00 2001 From: in0finite Date: Sun, 23 Jan 2022 21:45:40 +0100 Subject: [PATCH] performance optimizations --- Assets/Scripts/Editor/AssetExporter.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Editor/AssetExporter.cs b/Assets/Scripts/Editor/AssetExporter.cs index d004fb60..87bc23a0 100644 --- a/Assets/Scripts/Editor/AssetExporter.cs +++ b/Assets/Scripts/Editor/AssetExporter.cs @@ -258,7 +258,7 @@ namespace SanAndreasUnity.Editor currentObject.GetComponentOrThrow().Show(1f); - if (i % 50 == 0) + if (i % 100 == 0) { // wait for completion of jobs @@ -340,7 +340,9 @@ namespace SanAndreasUnity.Editor float diffPerc = endPerc - startPerc; long initialNumPendingJobs = LoadingThread.Singleton.GetNumJobsPending(); - + + yield return null; // this must be done, otherwise LoadingThread does not start processing any job + long numPendingJobs; do { @@ -356,7 +358,7 @@ namespace SanAndreasUnity.Editor yield break; } - yield return null; + System.Threading.Thread.Sleep(10); // don't interact with background thread too often, and also reduce CPU usage } while (numPendingJobs > 0);