Skip to content

Fix wrong icons in Light theme#656

Merged
thomas-tu merged 20 commits intomasterfrom
bugfix/low-res-light-icons
Mar 18, 2026
Merged

Fix wrong icons in Light theme#656
thomas-tu merged 20 commits intomasterfrom
bugfix/low-res-light-icons

Conversation

@thomas-tu
Copy link
Copy Markdown
Collaborator

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

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
UUM-136903

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
Copy Markdown

codecov-github-com Bot commented Mar 3, 2026

Codecov Report

All modified and coverable lines are covered by tests ✅

@@           Coverage Diff           @@
##           master     #656   +/-   ##
=======================================
  Coverage   36.05%   36.06%           
=======================================
  Files         277      277           
  Lines       34909    34918    +9     
=======================================
+ Hits        12588    12593    +5     
- Misses      22321    22325    +4     
Flag Coverage Δ
probuilder_MacOS_6000.0 34.52% <ø> (-0.06%) ⬇️
probuilder_MacOS_6000.3 34.52% <ø> (-0.06%) ⬇️
probuilder_MacOS_6000.4 34.51% <ø> (-0.06%) ⬇️
probuilder_MacOS_6000.5 34.52% <ø> (-0.06%) ⬇️
probuilder_MacOS_6000.6 34.52% <ø> (?)

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

see 4 files with indirect coverage changes

@thomas-tu thomas-tu self-assigned this Mar 3, 2026
Comment thread Editor/EditorCore/IconUtility.cs Outdated
Comment thread Editor/EditorCore/ProBuilderMeshEditor.cs Outdated
Comment thread Editor Default Resources/Icons/EditableMesh/EditMeshContext@2x.png.meta Outdated
Comment thread Editor/EditorCore/IconUtility.cs Outdated
@thomas-tu thomas-tu requested a review from marnadeau March 4, 2026 16:10
Copy link
Copy Markdown

@marnadeau marnadeau left a comment

Choose a reason for hiding this comment

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

The helpbox custom icon is not showing up on dark theme

Image

Also, all editor helpbox have recently been updated to use a 16px. Could you change the icon size to make them match (and fix the blurry effect at the same time)
Thanks!

Copy link
Copy Markdown

@unity-kristinn unity-kristinn left a comment

Choose a reason for hiding this comment

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

please fix problems with ci

also

getting this log message when updating package to this pr (also, shouldn't this be a warning? not a message?)

Image

@thomas-tu
Copy link
Copy Markdown
Collaborator Author

please fix problems with ci

also

getting this log message when updating package to this pr (also, shouldn't this be a warning? not a message?)

Image

Thanks. I'll check, but it's a message from the Editor I think.

@thomas-tu
Copy link
Copy Markdown
Collaborator Author

thomas-tu commented Mar 10, 2026

[9acc831](/Unity-Technologies/com.unity.probuilder/pull/656/commits/9acc8316fe9ecf47e2f723c98a1a8ae409a52b25)

@unity-kristinn, it should fixed with 9acc831.

Also, all editor helpbox have recently been updated to use a 16px. Could you change the icon size to make them match (and fix the blurry effect at the same time)

@marnadeau I updated the code so the new styling is applied on 6.5+. Helpbox still has 32px icon in all the previous versions of the Editor.

Comment thread Editor/EditorCore/IconUtility.cs
Comment thread Editor/EditorCore/IconUtility.cs
Comment thread Tests/Editor/Editor/IconUtilityTests.cs
Copy link
Copy Markdown

@marnadeau marnadeau left a comment

Choose a reason for hiding this comment

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

Everything is perfect now 🙏

@thomas-tu thomas-tu requested a review from varinotmUnity March 12, 2026 15:07
Copy link
Copy Markdown
Contributor

@varinotmUnity varinotmUnity left a comment

Choose a reason for hiding this comment

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

lgtm

@unity-kristinn
Copy link
Copy Markdown

/test_plan

@u-pr
Copy link
Copy Markdown

u-pr Bot commented Mar 16, 2026

Test Plan

  • Test plan approved by PR author
  • Test execution in progress
  • Test execution complete
  • Ready for merge

Summary of Changes & Risk Assessment

Summary of Changes

This PR standardizes ProBuilder's icon loading mechanism to align with Unity's internal d_ prefix convention for Light/Dark themes. It refactors IconUtility.GetIcon to use EditorGUIUtility.LoadIcon, updates numerous tool and component icon paths, and introduces a version-specific fix for HelpBox icon sizing in Unity 6000.5+.

Risk Assessment

  • High Risk Areas: None identified.
  • Medium Risk Areas: UI/UX consistency across themes, resource loading via package-relative paths.
  • Low Risk Areas: Unit tests for icon path validity.

Test Scenarios

Functional Testing

  • Theme Switching: Open the ProBuilder toolbar and a ProBuilder Mesh inspector. Switch between Light and Dark Editor themes. Verify all ProBuilder icons update to the correct theme-specific variant without errors.
  • Component Icons: Add a ProBuilderMesh or PolyShape component to a GameObject. Verify the component icon in the Inspector and Hierarchy matches the active theme.
  • Unity 6000.5+ HelpBox: On Unity 6000.5 or newer, verify that the ProBuilder warning/info helpboxes in the Inspector use the smaller 16px icons to match the standard Editor style.
  • Legacy Version HelpBox: On a Unity version older than 6000.5, verify that helpboxes still use the 32px icons as per the #else block in ProBuilderMeshEditor.cs.

Regression Testing

  • Icon Path Validity: Run the new test suite IconUtilityTests.cs. Ensure all listed paths in k_AllLiteralIconPaths return non-null textures.
  • Toolbar Icon Sharpness: Verify icons on high-DPI (4K/Retina) displays. IconUtility.GetIcon now relies on EditorGUIUtility.LoadIcon, which should automatically handle @2x suffixes.
  • PolyShape Creation: Activate the DrawPolyShapeTool from the toolbar and verify the icon remains visible and correct while the tool is active.

Edge Cases

  • Missing Icons: Intentionally pass a non-existent path to IconUtility.GetIcon (via a temporary debug script) and verify it returns null gracefully as tested in GetIcon_WithInvalidPath_ReturnsNull.
  • External Package Use: Verify icons still load correctly when ProBuilder is used as a read-only package vs. a local development folder.

💡 This test plan updates automatically when /test_plan is run on new commits. If you have any feedback, please reach out in #ai-qa


🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr

@thomas-tu
Copy link
Copy Markdown
Collaborator Author

[Yamato] Validate - probuilder - 6000.5 - macos failure is unrelated to this PR. Wrench needs to be updated.

@thomas-tu thomas-tu merged commit 02d8bb4 into master Mar 18, 2026
13 checks passed
@thomas-tu thomas-tu deleted the bugfix/low-res-light-icons branch March 18, 2026 18:55
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.

4 participants