Fix FPS drop with MelonLoader

This commit is contained in:
Sinai 2021-12-28 23:24:44 +11:00
parent 0050cff185
commit 0dd19345ed
3 changed files with 20 additions and 3 deletions

View File

@ -16,7 +16,7 @@ namespace UnityExplorer
public static class ExplorerCore
{
public const string NAME = "UnityExplorer";
public const string VERSION = "4.4.1";
public const string VERSION = "4.4.2";
public const string AUTHOR = "Sinai";
public const string GUID = "com.sinai.unityexplorer";

View File

@ -14,6 +14,7 @@ using UnityExplorer.UI.Panels;
using UnityExplorer.UI.Widgets;
using UniverseLib.UI;
using UniverseLib;
using System.Collections;
namespace UnityExplorer.ObjectExplorer
{
@ -254,6 +255,21 @@ namespace UnityExplorer.ObjectExplorer
// Scene Loader
ConstructSceneLoader();
RuntimeProvider.Instance.StartCoroutine(TempFixCoro());
}
// To "fix" a strange FPS drop issue with MelonLoader.
private IEnumerator TempFixCoro()
{
float start = Time.realtimeSinceStartup;
while (Time.realtimeSinceStartup - start < 2.5f)
yield return null;
// Select "HideAndDontSave" and then go back to first scene.
this.sceneDropdown.value = sceneDropdown.options.Count - 1;
this.sceneDropdown.value = 0;
}
private const string DEFAULT_LOAD_TEXT = "[Select a scene]";

View File

@ -133,10 +133,11 @@ namespace UnityExplorer.ObjectExplorer
LoadedScenes.Add(scene);
}
bool anyChange = confirmedCount != LoadedScenes.Count;
LoadedScenes.Add(DontDestroyScene);
LoadedScenes.Add(default);
bool anyChange = confirmedCount != LoadedScenes.Count;
previousLoadedScenes = new HashSet<Scene>(LoadedScenes);
// Default to first scene if none selected or previous selection no longer exists.