mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-19 15:51:48 +00:00
Move GC clearing out of coroutines
This commit is contained in:
1 parent
3eb0a4fdb3
commit
1b718092ee
1 file changed
+3
-10
@@ -326,7 +326,7 @@ public static class Extensions
|
||||
yield return null;
|
||||
if (clearGc)
|
||||
{
|
||||
yield return CoFreeResources();
|
||||
ClearGarbageCollector();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,15 +335,8 @@ public static class Extensions
|
||||
/// </summary>
|
||||
public static void ClearGarbageCollector()
|
||||
{
|
||||
Coroutines.Start(CoFreeResources());
|
||||
}
|
||||
|
||||
private static IEnumerator CoFreeResources()
|
||||
{
|
||||
yield return Resources.UnloadUnusedAssets();
|
||||
|
||||
GC.WaitForPendingFinalizers();
|
||||
GC.Collect(0, GCCollectionMode.Forced);
|
||||
Resources.UnloadUnusedAssets();
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user