Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Enter the 2020.2 Beta Sweepstakes for a chance to win an Oculus Quest 2.
    Dismiss Notice

Editor skinning thread

Discussion in '2019.3 Beta' started by pointcache, Jul 16, 2019.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    5,236
    Can you post a screenshot? :)
     
  2. TheZombieKiller

    TheZombieKiller

    Joined:
    Feb 8, 2013
    Posts:
    102
    It ends up looking pretty much exactly the same as the last editor screenshot I posted in this thread, so I figured it wasn't worth the effort to take one

    EDIT: The main difference is that the package manager is more readable (but still not entirely correct):
    Using a ripped dark.uss:
    upload_2019-7-25_17-53-3.png

    Using the script:
    upload_2019-7-25_17-53-27.png
     
    Last edited: Jul 25, 2019
    Grimreaper358 likes this.
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    5,236
    Ok. I wonder why the toolbar buttons don't change, because other stuff seems to look good.
     
  4. TheZombieKiller

    TheZombieKiller

    Joined:
    Feb 8, 2013
    Posts:
    102
    It almost feels like some stuff is still hard-coded or not properly moved over to UIElements yet, because I'm pretty sure all of the stylesheets are being properly modified.
     
  5. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    728
    I see all of this after just spending a few hours working through the ripped dark.uss and my file :D

    At about the same point now as the screenshots above except, that the Package Manager is the same as the top screenshot. Profiler Still needs work as well as some icons. @TheZombieKiller Did the script also get all the icons/image file for the dark theme or just some of them?


    Tested your script and it doesn't seem to change some of the icons (Same ones I'm missing) to the dark theme version. Also, My Package manager gets a style from yours, almost fully switched to the dark version. I think Your Script mixed the generated styling with mine.

    I switched to a project that has the version I am working on without the theme inverter/converter and the Package Manager still looks the same as the project I used it in..

    upload_2019-7-25_20-37-26.png
     
    Last edited: Jul 26, 2019
  6. TheZombieKiller

    TheZombieKiller

    Joined:
    Feb 8, 2013
    Posts:
    102
    It's weird... it's almost like some of the icons simply aren't specified via stylesheets yet.

    Yeah, the dark theme patch will persist until the editor is restarted.
     
  7. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,065
    Which version are ya'll using? I imagine that could make a difference, yes?
     
  8. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,048
  9. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,799
    @TheZombieKiller It seems some of the fonts have a black color with the script, is there a way to exclude the font colours from inverting?
     

    Attached Files:

  10. TheZombieKiller

    TheZombieKiller

    Joined:
    Feb 8, 2013
    Posts:
    102
    @Lars-Steenhoff I think it's less that the text is being inverted, and more that it isn't being affected at all.
     
  11. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,048
    Is it possible to take the inverted style and export it as a static style so it can be edited?
     
  12. TheZombieKiller

    TheZombieKiller

    Joined:
    Feb 8, 2013
    Posts:
    102
    Yeah, I posted some code earlier in the thread to dump stylesheets, although I think it needs some minor changes to work with the latest version of Unity.
     
  13. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,048
    I tried to run it, but keep getting the following:

    Code (CSharp):
    1. [Exception] NullReferenceException: Object reference not set to an instance of an object
    2. StyleSheetToUss.ToUssString()    Assets/Theme/Exporter/StyleSheetToUss.cs:356
    3. 354:   }
    4. 355:   var sb = new StringBuilder();
    5. -->356:   if (sheet.complexSelectors != null)
    6. 357:   {
    7. 358:       for (var complexSelectorIndex = 0; complexSelectorIndex < sheet.complexSelectors.Length; ++complexSelectorIndex)
    8.  
    9. StyleSheetToUss.WriteStyleSheet()    Assets/Theme/Exporter/StyleSheetToUss.cs:374
    10. 372:       public static void WriteStyleSheet(StyleSheet sheet, string path, UssExportOptions options = null)
    11. 373:       {
    12. -->374:           File.WriteAllText(path, ToUssString(sheet, options));
    13. 375:       }
    14. 376:   }
    15.  
    16. StyleSheetExporter.Export()    Assets/Theme/Exporter/StyleSheetExporter.cs:57
    17. 55:           if (!string.IsNullOrWhiteSpace(folder))
    18. 56:               Directory.CreateDirectory(folder);
    19. -->57:           StyleSheetToUss.WriteStyleSheet(sheet, write);
    20. 58:       }
    21. 59:   }
    22.  
     
  14. TheZombieKiller

    TheZombieKiller

    Joined:
    Feb 8, 2013
    Posts:
    102
    There's a solution for that earlier in this thread as well, it involves adding the StyleSheetToUss.cs file into your project and making a minor change to it.
     
  15. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,048
    Yes, I have done that. I made sure to go over all the steps you had twice. I also did the change for having the check for the null string, I believe it was.

    I suppose it might be the placement of that file, does folder structure matter? I placed the file in the same folder as the export file and the assembly definition.
     
  16. TheZombieKiller

    TheZombieKiller

    Joined:
    Feb 8, 2013
    Posts:
    102
    Hmm, maybe it's been broken yet again. What version of Unity are you using?
     
  17. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,048
    The newest beta as of this moment. I believe it is 2019.3.0b3.
     
  18. TheZombieKiller

    TheZombieKiller

    Joined:
    Feb 8, 2013
    Posts:
    102
    Just tried it in 2020.1.0a3 and it worked fine. I put everything in a folder called Assembly-CSharp-Editor-testable like so:

    Code (csharp):
    1.  
    2. Assembly-CSharp-Editor-testable/
    3.     Assembly-CSharp-Editor-testable.asmdef
    4.     Assembly-CSharp-Editor-testable.asmdef.meta
    5.     StyleSheetExporter.cs
    6.     StyleSheetExporter.cs.meta
    7.     StyleSheetToUss.cs
    8.     StyleSheetToUss.cs.meta
    StyleSheetExporter.cs is the script from https://forum.unity.com/threads/uni...ui-look-like-garbage-now.709037/#post-4751006 with the fixes mentioned earlier in this thread, to clarify.
     
  19. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,048
    The modifications were:

    StyleSheetExporter.cs : line 55
    Code (CSharp):
    1. if (!string.IsNullOrWhiteSpace(folder))
    2.     Directory.CreateDirectory(folder);
    Then in StyleSheetToUss.cs change the namespace to : ThemeExporter.StyleSheets
    Then change the using statement in StyleSheetExporter.cs to reflect this change.

    As well as StyleSheetToUss.cs : line 186
    Code (CSharp):
    1.                 case StyleValueType.Variable:
    2.                 case StyleValueType.Keyword:
    Does anything need to be set within the Assembly definition settings? As seen here I have the files placed just as you mentioned.

    I do use Linux, not sure if perhaps that might have some impact on this? I would not think that it should.

     
    Last edited: Sep 17, 2019
  20. TheZombieKiller

    TheZombieKiller

    Joined:
    Feb 8, 2013
    Posts:
    102
    Hmm, I wonder. What if you change
    Code (CSharp):
    1. StyleSheetToUss.WriteStyleSheet(sheet, write);
    to
    Code (CSharp):
    1. if (sheet)
    2.     StyleSheetToUss.WriteStyleSheet(sheet, write);
    ?

    The error seems to be related to a stylesheet being null.
     
  21. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,048
    Well, it didn't error, but then it seems it didn't end up doing anything at all at that point?
     
    Last edited: Sep 17, 2019
  22. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,048
    Ok, so I was able to generate them. I tried to invert it using your other script first and then generate, which it looks like it did judging by several of the colors set in the file. Though, either I must be doing something wrong with the actual StyleSheets, or they don't seem to actually do anything. So far the *only* thing I have been able to use to make an actual noticable permanent change when it comes to style sheets is downloading the little tiny one-liner (3 lines) from the Unity dev who linked to one that had .dockheader or something along those lines in it, which did in fact change the color of the dock. It was in StyleSheets/Extensions/ ** light.uss/dark.uss/common.uss.

    I had the generated/exported stylesheets from your script located in Assets/Editor/StyleSheets/**. I tried to make a few manual changes to them just to see if they would produce and noticable changes but I have yet to see any. Is this to be expected? I noticed several of you fellas had much more changes outside of just running the inversion script. I have yet to find a copy of a StyleSheet anywhere that I could try and use.
     
  23. starfoxy

    starfoxy

    Joined:
    Apr 24, 2016
    Posts:
    83
    This is awesome guys! Any chance this will all be packaged together to help us make our own ui themes?
     
    MostHated likes this.
  24. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,048
    It is, but it also sucks. Everything is there and available to fully theme the entire editor however you wish, but I just don't have all of the pieces to this puzzle.
     
  25. TheZombieKiller

    TheZombieKiller

    Joined:
    Feb 8, 2013
    Posts:
    102
    You may need to restart the editor, or run some code that calls EditorUtility.RequestScriptReload/InternalEditorUtility.RequestScriptLoad followed by InternalEditorUtility.RepaintAllViews. I recall having a bit of trouble trying to get the changes to apply at first as well.
     
    MostHated likes this.
  26. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,048
    I thought that might be the case as most times that I use the invert colors script I have to hit play and then stop, but none of that seems to be working. Just to see, I put the Extensions folder back in with the common, light, and dark.uss files in it and the color instantly changed for that one dockheader that was in there, I took it back out, color went away, still nothing from the StyleSheet.

    I have the StyleSheets folder within Editor, Editor/StyleSheets/Generated/ => which has 4 files in it for DefaultCommonLight/Dark, then same for Toolbar, then on up in StyleSheets is another set of DefaultCommonLight/Dark.uss. Does that sound like it is supposed to be?
     
  27. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    486
    I've managed to fix some of the issues and created something between dark and light. Repo soon.

     
  28. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    728
    Nice! how did you get the icons to edit them as well as edit the package manager font color?
     
  29. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,065
    Ooo very nice. It would be so cool to get a tool that lets us make our own themes, like blender does. I know there used to be a tool like that but it no longer works
     
  30. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    486
    Got everything from
    Resources.FindObjectsOfTypeAll<T>();
     
  31. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    486
    More progress:
    - styleSheet.name == "PreviewWindow" has to be ignored otherwise preview is inverted :)
    - all text rendered correctly
    - added more icons, right now ~2200 of them


    But now I'm stuck... As u can see above folder icons in Project window are wrong although I made an icon and even set all GUI.skins to use it ;/

    Fun fact: it almost works in 2019.2 too



    Edit
    Nvm fixed


    Edit2
    Looking at C# inspector, it's using AssetDatabase.GetCachedIcon(path) that's implemented in C++. No idea how it's working.

    Tried using https://github.com/Unity-Technologi...ter/Editor/Mono/GenerateIconsWithMipLevels.cs it did generated icons but they are not used by Unity

    Edit3
    UnityRed anyone :D?
     
    Last edited: Sep 23, 2019
  32. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    486
    Found a way! Even toggle check marks are dark.



    Edit
    3 dots weren't working but now they are
     
    Last edited: Sep 23, 2019
    Peter77, TextusGames and starfoxy like this.
  33. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,048
    This is great! Did you have a repo setup or anything, or are you just taunting us with this amazingness, lol?
     
  34. DeoSsin

    DeoSsin

    Joined:
    Mar 2, 2017
    Posts:
    2
    Btw, is it possible to strip 19.2 theme and insert it in 19.3+ Hmm...
     
  35. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    486
    I'm mainly showing that it's possible and not that hard. ~500 lines of code does everything. I'd open a repo but I'm worried about Unity patching the ways I did the conversion. Especially since for ex. my hacky icon swap crashes unity 2019.2 lol. I'd like to know if there is any proper/public way to replace AssetDatabase.GetCachedIcon(path) icons. @jonathans42

    Just tried and it worked! Presenting you Unity 2019.3 light skin inverted with 2019.2 light inverted icons. (+ font from preferences)



    Whatever happens Ill open repo when .3 is out of beta
     
    Last edited: Sep 24, 2019
  36. starfoxy

    starfoxy

    Joined:
    Apr 24, 2016
    Posts:
    83

    Super exciting and excellent work!
     
  37. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,048
    I don't think any of this stuff is on accident/secret. They purposely exposed everything to be edited and expected people to dig around through it. I don't think there is any reason to have to hide any of it. I mean, a Unity member was the first one to post a small example on how to change color in the editor that I saw. I think they are just quietly sitting back to see who busts out the hotness first, lol.

    It would be nice if perhaps someone could confirm that it's ok to do this so that everyone doesn't have to feel like they are doing something wrong and people can start sharing the awesomeness guilt free.
     
    Last edited: Sep 26, 2019
    Lurking-Ninja likes this.
  38. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    486
    Hmm some news about dark inc in 2020:
     
  39. JoNax97

    JoNax97

    Joined:
    Feb 4, 2016
    Posts:
    382
    It is coming boys
     
    MostHated likes this.
  40. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,065
  41. starfoxy

    starfoxy

    Joined:
    Apr 24, 2016
    Posts:
    83
    Hey everyone, any new updates on this with the 2019.3 final being released?
     
  42. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,065
    What I've heard from the rumors is the possibility of it coming in 2020 versions at some point
     
  43. LukeDJ

    LukeDJ

    Joined:
    Oct 2, 2017
    Posts:
    7
    I totally agree, it would be nice if someone could confirm that it's fine to do all this.
    Excited to hopefully see an official dark mode come to Unity Personal 2020!
     
  44. benoitd_unity

    benoitd_unity

    Unity Technologies

    Joined:
    Jan 2, 2018
    Posts:
    226
    Hi everyone,

    So I got the confirmation from the legal department that creating modified style sheets and sharing them is not breaking the EULA.

    That being said, the ability to do so is a side effect of the the improvements we made to our UI systems, to make it easier for everyone to create customized tools. Sharing them is not something we want to encourage, for the simple fact that we can't guarantee that what you distribute won't break in the future, as it was not meant to be used this way.

    Creating and sharing Editor themes is something I would really like to have in the product though, with the proper tools and delivery mechanisms.

    You guys are making some really cool looking themes by the way :)
     
  45. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    486
    Nice
    I can imagine that the way I found can be very easily broken on purpose in future updates :(

    I've been using it for some time:


    Source soon
     
    MostHated likes this.
  46. benoitd_unity

    benoitd_unity

    Unity Technologies

    Joined:
    Jan 2, 2018
    Posts:
    226
    We're not planning to add constraining measures on purpose, we'd rather enable better tooling for this, we're just not ready yet. The work that has been done for the new Editor themes in 2019.3 will certainly evolve and we're not certain how yet. So it might break, but it won't be to counter whatever you're doing.

    A note on Dark Theme, as it seems to be the main driver for doing heavy customization. If it was only for me, it would be free. I've been pushing really hard for this to happen during the last year and although we're getting very close to an agreement, we're still not there yet. And frankly, if some people are using that method so they can spend more quality time within Unity, then so be it.
     
    Last edited: Mar 24, 2020
    mopthrow, Rewaken, Novack and 14 others like this.
  47. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    542
    The hero we need, but don't deserve.
    Thank you, very good news.
     
    Rewaken, ModLunar, Alverik and 3 others like this.
  48. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    486
    Well rip, it stopped working, looks like editor icons are no longer loaded from the folder :(
     
  49. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    486
    Source, maybe someone finds why it doesn't work:
    https://github.com/kamyker/UnityDarkenThemer

    Changing icons still works:
    Code (CSharp):
    1. var texture2 = (Texture2D)EditorGUIUtility.LoadRequired("Icons/" + texture.name + ".png");
    2.                     texture.UpdateExternalTexture( texture2.GetNativeTexturePtr() );
     
  50. xeleh

    xeleh

    Joined:
    Jul 22, 2016
    Posts:
    300
    Don't worry. I have my own solution working flawlessly with Unity 2019.3.11 and even with the Unity 2020.1 beta versions. I will be sharing the repository later today. In the meantime, take a sneak peek...

     
    Rewaken, 2dchaos, Stardog and 5 others like this.
unityunity