Skip to content

Fix wrong icons in Light theme#656

Open
thomas-tu wants to merge 4 commits intomasterfrom
bugfix/low-res-light-icons
Open

Fix wrong icons in Light theme#656
thomas-tu wants to merge 4 commits intomasterfrom
bugfix/low-res-light-icons

Conversation

@thomas-tu
Copy link
Collaborator

@thomas-tu thomas-tu commented Mar 3, 2026

DO NOT FORGET TO INCLUDE A CHANGELOG ENTRY

Purpose of this PR

When using the Editor Light theme, some icons pulled are from the Dark theme. The affected icons are reference throught the [Icon(icon-path)] attribute so they follow the rule where file paths should be named as following:

my-icon.png --> light theme
d_my-icon.png --> dark theme

Probuilder handles the loading and the differentiation between both skins for most icon, by using its own IconUtility.GetIcon() but it follow differents rules:

my-icon.png --> dark theme
my-icon_Light.png --> light theme

I've updated the method so we can override for the specific case where the targeted icon is also being used with the IconAttribute. It's the case for one of the icon where it's in an attribute, but also being loaded through the API.

Before:
image

After:
image

Links

Jira: UUM-133531

Comments to Reviewers

[List known issues, planned work, provide any extra context for your code.]

@thomas-tu thomas-tu changed the title Bugfix/low res light icons Fix wrong icons in Light theme Mar 3, 2026
@codecov-github-com
Copy link

codecov-github-com bot commented Mar 3, 2026

Codecov Report

Attention: Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
Editor/EditorCore/ProBuilderMeshEditor.cs 0.00% 1 Missing ⚠️
Editor/MenuActions/Editors/NewBezierShape.cs 0.00% 1 Missing ⚠️
@@           Coverage Diff           @@
##           master     #656   +/-   ##
=======================================
  Coverage   36.05%   36.05%           
=======================================
  Files         277      277           
  Lines       34909    34909           
=======================================
  Hits        12588    12588           
  Misses      22321    22321           
Flag Coverage Δ
probuilder_MacOS_6000.0 34.58% <80.00%> (ø)
probuilder_MacOS_6000.3 34.58% <80.00%> (ø)
probuilder_MacOS_6000.4 34.57% <80.00%> (ø)
probuilder_MacOS_6000.5 34.57% <80.00%> (ø)
probuilder_MacOS_6000.6 34.57% <80.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
Editor/EditorCore/IconUtility.cs 84.61% <100.00%> (ø)
Editor/EditorCore/UVEditor.cs 39.78% <100.00%> (ø)
Editor/MenuActions/Geometry/ExtrudeFaces.cs 11.22% <100.00%> (ø)
Editor/MenuActions/Interaction/ToggleXRay.cs 36.84% <ø> (ø)
Editor/EditorCore/ProBuilderMeshEditor.cs 9.77% <0.00%> (ø)
Editor/MenuActions/Editors/NewBezierShape.cs 71.42% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@thomas-tu thomas-tu self-assigned this Mar 3, 2026
/// <param name="skin"></param>
/// <returns></returns>
public static Texture2D GetIcon(string iconName, IconSkin skin = IconSkin.Default)
public static Texture2D GetIcon(string iconName, string withPrefix = "", string withSuffix = "_Light", IconSkin skin = IconSkin.Default)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused, isn't that the old convention? Shouldn't we default to the prefix d_ and not the suffix _Light?

Copy link
Contributor

@varinotmUnity varinotmUnity Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I would think it's better when adding on top of existing API the new parameters at the end instead of in the middle to avoid causing compilation errors if people upgrade

const string k_IconPath = "EditableMesh/EditMeshContext";
const string k_ComponentMessage = "Use the ProBuilder Edit Mode in the Scene Tools Overlay to edit this Mesh.";
public static readonly GUIContent helpLabelContentIcon = new GUIContent(IconUtility.GetIcon(k_IconPath));
public static readonly GUIContent helpLabelContentIcon = new GUIContent(IconUtility.GetIcon(k_IconPath, "d_", null));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not enough of a c# expert, but how does it handle concatenating null string? I would play it safe with ""

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, I've set a nullable string when I started to make the changes, before going back to string.Empty in the GetIcon's signature. Will update this. Thanks for catching this!

wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just wondering why the meta files changed so much, especially those values

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to try to revert the changes on the importer settings. There shouldn't be any change there.

@@ -26,10 +26,12 @@ static class IconUtility
/// <param name="iconName"></param>
/// <param name="skin"></param>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to update XML

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants