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

Commit d070ded

Browse files
committed
3.3.3
* Fix `Hide on Startup` not working * Fix for cases when we try to `scene.GetRootGameObjects()` but the scene has not yet fully loaded. * MelonLoader releases will no longer spam "Preferences Saved!" constantly in the Console log * Fix mistake with UI Event System setting/releasing * Fix some UI elements not having correct Color transition values
1 parent 8f02562 commit d070ded

File tree

11 files changed

+80
-10
lines changed

11 files changed

+80
-10
lines changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,34 @@ The standalone release is based on the BepInEx build, so it requires Harmony 2.0
3838
1. Create an instance of Unity Explorer with `UnityExplorer.ExplorerStandalone.CreateInstance();`
3939
2. Optionally subscribe to the `ExplorerStandalone.OnLog` event to handle logging if you wish.
4040

41+
## Issues and contributions
42+
43+
Both issue reports and PR contributions are welcome in this repository.
44+
45+
### Issue reporting
46+
47+
To report an issue with UnityExplorer, please use the following template (as well as any other information / images you can provide).
48+
49+
Please upload the required log files on [Pastebin](https://pastebin.com/) and include a link to your paste:
50+
51+
* All reports: Unity's `output_log.txt` or `Player.log`, should be found at `%userprofile%\AppData\LocalLow\[Company]\[Game]\` unless redirected.
52+
* BepInEx: `BepInEx\LogOutput.log`
53+
* MelonLoader: `MelonLoader\Latest.log`
54+
55+
Template:
56+
57+
```
58+
* OS Platform:
59+
* Display resolution:
60+
* Game(s) tested on:
61+
* UnityExplorer version(s) tested:
62+
63+
* Description of issue:
64+
65+
* Unity log pastebin link:
66+
* Mod Loader log pastebin link:
67+
```
68+
4169
## Features
4270

4371
<p align="center">

src/Core/Config/ConfigManager.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Globalization;
44
using System.IO;
55
using System.Linq;
6+
using System.Runtime.InteropServices;
67
using System.Text;
78
using UnityEngine;
89
using UnityExplorer.UI.Main;
@@ -45,6 +46,8 @@ public static void Init(ConfigHandler configHandler)
4546
PanelDragger.OnFinishDrag += PanelDragger_OnFinishDrag;
4647
MainMenu.OnActiveTabChanged += MainMenu_OnActiveTabChanged;
4748
DebugConsole.OnToggleShow += DebugConsole_OnToggleShow;
49+
50+
InitConsoleCallback();
4851
}
4952

5053
internal static void RegisterConfigElement<T>(ConfigElement<T> configElement)
@@ -134,6 +137,33 @@ private static void SceneExplorer_OnToggleShow(bool showing)
134137
Last_SceneExplorer_State.Value = showing;
135138
}
136139

140+
#region CONSOLE ONEXIT CALLBACK
141+
142+
internal static void InitConsoleCallback()
143+
{
144+
handler = new ConsoleEventDelegate(ConsoleEventCallback);
145+
SetConsoleCtrlHandler(handler, true);
146+
}
147+
148+
static bool ConsoleEventCallback(int eventType)
149+
{
150+
// 2 is Console Quit
151+
if (eventType == 2)
152+
Handler.SaveConfig();
153+
154+
return false;
155+
}
156+
157+
static ConsoleEventDelegate handler;
158+
private delegate bool ConsoleEventDelegate(int eventType);
159+
160+
[DllImport("kernel32.dll", SetLastError = true)]
161+
private static extern bool SetConsoleCtrlHandler(ConsoleEventDelegate callback, bool add);
162+
163+
#endregion
164+
165+
#region WINDOW ANCHORS / POSITION HELPERS
166+
137167
// Window Anchors helpers
138168

139169
private const string DEFAULT_WINDOW_ANCHORS = "0.25,0.10,0.78,0.95";
@@ -210,5 +240,7 @@ internal static void SetPositionFromString(this RectTransform rect, string strin
210240
//ExplorerCore.LogWarning("Exception setting window position: " + ex);
211241
}
212242
}
243+
244+
#endregion
213245
}
214246
}

src/Core/Input/CursorUnlocker.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,17 @@ public static void UpdateCursorControl()
125125
{
126126
Cursor.lockState = CursorLockMode.None;
127127
Cursor.visible = true;
128+
129+
if (UIManager.EventSys)
130+
SetEventSystem();
128131
}
129132
else
130133
{
131134
Cursor.lockState = m_lastLockMode;
132135
Cursor.visible = m_lastVisibleState;
136+
137+
if (UIManager.EventSys)
138+
ReleaseEventSystem();
133139
}
134140
m_currentlySettingCursor = false;
135141
}

src/Core/Runtime/Il2Cpp/Il2CppProvider.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,13 @@ public override int GetSceneHandle(Scene scene)
8989

9090
internal delegate void d_GetRootGameObjects(int handle, IntPtr list);
9191

92-
public override GameObject[] GetRootGameObjects(Scene scene) => GetRootGameObjects(scene.handle);
93-
94-
public static GameObject[] GetRootGameObjects(int handle)
92+
public override GameObject[] GetRootGameObjects(Scene scene)
9593
{
94+
if (!scene.isLoaded)
95+
return new GameObject[0];
96+
97+
int handle = scene.handle;
98+
9699
if (handle == -1)
97100
return new GameObject[0];
98101

src/Core/Runtime/Mono/MonoProvider.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ public override int GetSceneHandle(Scene scene)
5252

5353
public override GameObject[] GetRootGameObjects(Scene scene)
5454
{
55+
if (!scene.isLoaded)
56+
return new GameObject[0];
57+
5558
return scene.GetRootGameObjects();
5659
}
5760

src/ExplorerCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace UnityExplorer
1212
public class ExplorerCore
1313
{
1414
public const string NAME = "UnityExplorer";
15-
public const string VERSION = "3.3.2";
15+
public const string VERSION = "3.3.3";
1616
public const string AUTHOR = "Sinai";
1717
public const string GUID = "com.sinai.unityexplorer";
1818

src/Loader/ML/MelonLoaderConfigHandler.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public override T GetConfigValue<T>(ConfigElement<T> config)
6969

7070
public override void OnAnyConfigChanged()
7171
{
72-
MelonPreferences.Save();
7372
}
7473

7574
public override void SaveConfig()

src/UI/Main/Home/Inspectors/GameObjects/ChildList.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ internal void AddChildListButton()
169169
toggle.onValueChanged.AddListener((bool val) => { OnToggleClicked(thisIndex, val); });
170170

171171
ColorBlock mainColors = new ColorBlock();
172-
RuntimeProvider.Instance.SetColorBlock(mainColors, new Color(0.07f, 0.07f, 0.07f),
172+
mainColors = RuntimeProvider.Instance.SetColorBlock(mainColors, new Color(0.07f, 0.07f, 0.07f),
173173
new Color(0.2f, 0.2f, 0.2f, 1), new Color(0.05f, 0.05f, 0.05f));
174174

175175
var mainBtn = UIFactory.CreateButton(btnGroupObj,

src/UI/Main/Home/Inspectors/GameObjects/ComponentList.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ internal void AddCompListButton()
176176
// Main component button
177177

178178
ColorBlock mainColors = new ColorBlock();
179-
RuntimeProvider.Instance.SetColorBlock(mainColors, new Color(0.07f, 0.07f, 0.07f),
179+
mainColors = RuntimeProvider.Instance.SetColorBlock(mainColors, new Color(0.07f, 0.07f, 0.07f),
180180
new Color(0.2f, 0.2f, 0.2f, 1), new Color(0.05f, 0.05f, 0.05f));
181181

182182
var mainBtn = UIFactory.CreateButton(groupObj,

src/UI/Main/MainMenu.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ private void ConstructTitleBar(GameObject content)
180180
// Hide button
181181

182182
ColorBlock colorBlock = new ColorBlock();
183-
RuntimeProvider.Instance.SetColorBlock(colorBlock, new Color(65f / 255f, 23f / 255f, 23f / 255f),
183+
colorBlock = RuntimeProvider.Instance.SetColorBlock(colorBlock, new Color(65f / 255f, 23f / 255f, 23f / 255f),
184184
new Color(35f / 255f, 10f / 255f, 10f / 255f), new Color(156f / 255f, 0f, 0f));
185185

186186
var hideButton = UIFactory.CreateButton(titleBar,

0 commit comments

Comments
 (0)