UnityEditor-DarkMode icon indicating copy to clipboard operation
UnityEditor-DarkMode copied to clipboard

希望可以根据Unity当前主题自动启用或禁用

Open QJJXK555 opened this issue 11 months ago • 1 comments
trafficstars

我使用Auto Dark Theme插件来自动切换主题,希望当使用亮色主题时就不要改变颜色了

QJJXK555 avatar Nov 28 '24 09:11 QJJXK555

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

0x7c13 avatar Dec 04 '24 17:12 0x7c13