Skip to content

Commit 46f0d21

Browse files
committed
Update README.md
1 parent d7eaf1e commit 46f0d21

File tree

1 file changed

+1
-36
lines changed

1 file changed

+1
-36
lines changed

README.md

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,7 @@ A fully working runtime dark mode mod for Unity Editor on Windows with:
1515
- Download the `UnityEditorDarkMode.dll` from [releases](https://github.com/0x7c13/UnityEditor-DarkMode/releases)
1616

1717
> **WARNING:** If you feel uncomfortable downloading a malicious DLL from a stranger like me, then you should not:) Take a look at later sections to see how it works and how to build it yourself if you prefer. Please do your own homework and make your own judgement. I offer this approach as a convenience for those who don't want to build a C++ project themselves.
18-
- Now, you have two options:
19-
20-
Option 1: Add a Unity editor script to your project like below:
21-
```C#
22-
#if UNITY_EDITOR_WIN // Windows only, obviously
23-
namespace Editor.Theme // Change this to your own namespace you like or simply remove it
24-
{
25-
using System.Runtime.InteropServices;
26-
using UnityEditor;
27-
28-
public static class UnityEditorDarkMode
29-
{
30-
// Change below path to the path of the downloaded dll or
31-
// simply put the dll in the same directory as the script and use
32-
// [DllImport("UnityEditorDarkMode.dll", EntryPoint = "DllMain")] instead
33-
[DllImport(@"C:\Users\<...>\Desktop\UnityEditorDarkMode.dll", EntryPoint = "DllMain")]
34-
private static extern void _();
35-
36-
[InitializeOnLoadMethod]
37-
private static void __()
38-
{
39-
#if !UNITY_2021_1_OR_NEWER
40-
// [InitializeOnLoadMethod] is getting called before the editor
41-
// main window is created on earlier versions of Unity, so we
42-
// need to wait a bit here before attaching the dll.
43-
System.Threading.Thread.Sleep(100);
44-
#endif
45-
_(); // Attach the dll to the Unity Editor
46-
}
47-
}
48-
}
49-
#endif
50-
```
51-
Option 2 (Unity 2021 or higher): Copy the DLL into your Unity project and apply below settings to the DLL in the Unity Editor inspector:
18+
- Copy the DLL into your Unity project and apply below settings to the DLL in the Unity Editor inspector:
5219

5320
![dll-setting](screenshot-dll-setting.png?raw=true)
5421

@@ -103,5 +70,3 @@ Ok, so what I have done on top of `ReaperThemeHackDll` is:
10370
10471
## Known issues
10572
> I haven't found any major issues so far. Please let me know if you find any issues by creating an issue in this repository.
106-
107-
The reason why the DLL injection script is different for `Unity 2021 or later` and `Unity 2020 or earlier` is because the `[InitializeOnLoadMethod]` is getting called before the main window is created in earlier versions of Unity (2019, 2020). This is causing the sub-classing to fail since the main window is not found at dll attach time. So a simple workaround is to manually invoke the dll after the main window is created by sleeping the thread for some time. 100 ms is about right but you can adjust it if you encounter issues.

0 commit comments

Comments
 (0)