UnityEditor-DarkMode
UnityEditor-DarkMode copied to clipboard
希望可以根据Unity当前主题自动启用或禁用
https://discussions.unity.com/t/is-there-a-way-to-get-editor-background-color/67691/2 + #if UNITY_EDITOR_WIN // Windows only, obviously namespace Editor.Theme // Change this to your own namespace you like or simply remove it { using System.Runtime.InteropServices; using UnityEditor;
public static class UnityEditorDarkMode
{
// Change below path to the path of the downloaded dll
[DllImport(@"C:\Users\<...>\Desktop\UnityEditorDarkMode.dll", EntryPoint = "DllMain")]
private static extern void _();
[InitializeOnLoadMethod]
private static void __()
{
#if !UNITY_2021_1_OR_NEWER
// [InitializeOnLoadMethod] is getting called before the editor
// main window is created on earlier versions of Unity, so we
// need to wait a bit here before attaching the dll.
System.Threading.Thread.Sleep(100);
#endif
if (EditorGUIUtility.isProSkin)
{
_(); // Attach the dll to the Unity Editor
}
}
}
} #endif