Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit 0dd1934

Browse files
committed
Fix FPS drop with MelonLoader
1 parent 0050cff commit 0dd1934

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

src/ExplorerCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace UnityExplorer
1616
public static class ExplorerCore
1717
{
1818
public const string NAME = "UnityExplorer";
19-
public const string VERSION = "4.4.1";
19+
public const string VERSION = "4.4.2";
2020
public const string AUTHOR = "Sinai";
2121
public const string GUID = "com.sinai.unityexplorer";
2222

src/ObjectExplorer/SceneExplorer.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
using UnityExplorer.UI.Widgets;
1515
using UniverseLib.UI;
1616
using UniverseLib;
17+
using System.Collections;
1718

1819
namespace UnityExplorer.ObjectExplorer
1920
{
@@ -254,6 +255,21 @@ public override void ConstructUI(GameObject content)
254255
// Scene Loader
255256

256257
ConstructSceneLoader();
258+
259+
RuntimeProvider.Instance.StartCoroutine(TempFixCoro());
260+
}
261+
262+
// To "fix" a strange FPS drop issue with MelonLoader.
263+
private IEnumerator TempFixCoro()
264+
{
265+
float start = Time.realtimeSinceStartup;
266+
267+
while (Time.realtimeSinceStartup - start < 2.5f)
268+
yield return null;
269+
270+
// Select "HideAndDontSave" and then go back to first scene.
271+
this.sceneDropdown.value = sceneDropdown.options.Count - 1;
272+
this.sceneDropdown.value = 0;
257273
}
258274

259275
private const string DEFAULT_LOAD_TEXT = "[Select a scene]";

src/ObjectExplorer/SceneHandler.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,11 @@ internal static void Update()
133133
LoadedScenes.Add(scene);
134134
}
135135

136-
bool anyChange = confirmedCount != LoadedScenes.Count;
137-
138136
LoadedScenes.Add(DontDestroyScene);
139137
LoadedScenes.Add(default);
138+
139+
bool anyChange = confirmedCount != LoadedScenes.Count;
140+
140141
previousLoadedScenes = new HashSet<Scene>(LoadedScenes);
141142

142143
// Default to first scene if none selected or previous selection no longer exists.

0 commit comments

Comments
 (0)