Skip to content

Fixing tools icons not loading properly when importing the package#668

Merged
lopezt-unity merged 1 commit into
coreclr/uum-131032-fast-enter-playmodefrom
bugfix/uum-142556-fix-tool-icons-onpackageimport
May 25, 2026
Merged

Fixing tools icons not loading properly when importing the package#668
lopezt-unity merged 1 commit into
coreclr/uum-131032-fast-enter-playmodefrom
bugfix/uum-142556-fix-tool-icons-onpackageimport

Conversation

@lopezt-unity

Copy link
Copy Markdown
Collaborator

Purpose of this PR

Fixed an issue where the PolyShape and CreateCube tool buttons would show significant letters instead of the icons when loading the ProBuilder package in a project.
This would be corrected after a domain reload.

Switching from toolbarIcon to the Icon attribute fixes that.

Links

Jira: https://jira.unity3d.com/browse/UUM-142556

Comments to Reviewers

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

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great

The pull request overall looks solid, with only one potential issue identified.

Summary of Findings

  • Performance / Caching in IconUtility: Not caching null values for missing or misspelled icons may lead to repetitive disk lookups via EditorGUIUtility.LoadIcon during GUI repaint loops, potentially degrading performance.

🤖 Helpful? 👍/👎


icon = EditorGUIUtility.LoadIcon(fullPath);
s_Icons.Add(iconName, icon);
if(icon != null)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

While not caching null successfully prevents temporary startup/import load failures from being cached permanently, it introduces a potential performance regression. If an icon is permanently missing or misspelled, GetIcon will perform string operations and EditorGUIUtility.LoadIcon (which triggers disk and asset database searches) on every call. If this occurs within GUI repaint loops (like OnGUI), it can degrade Editor performance.

Have you considered keeping track of failed lookups in a separate static set and clearing it on a specific lifecycle event (e.g., when package compilation/import completes), or is the risk of permanently missing icons considered negligible enough to accept this trade-off?

🤖 Helpful? 👍/👎

@modrimkus-unity modrimkus-unity left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! In addition did a manual test pass on mac - icons show correctly on first import.

@lopezt-unity lopezt-unity merged commit d836c7e into coreclr/uum-131032-fast-enter-playmode May 25, 2026
4 checks passed
@lopezt-unity lopezt-unity deleted the bugfix/uum-142556-fix-tool-icons-onpackageimport branch May 25, 2026 13:56
lopezt-unity added a commit that referenced this pull request May 27, 2026
* builtin mat and csg files changes

* Updating Poly2Tri for fast enter playmode

* fast enter playmode for materials, log, normals

* moving the rest of the runtime scripts to be compatible with fast enter playmode

* update ShowHoveredInfo

* Updating editor menu actions for fast enter playmode

* Fixing overlay not showing on the first action

* Adding Runtime Init on load attribute to reset editor scripts part.1

* switch attribute to InitializeOnEnterPlaymode for the editor only code

* best support of fast entering playmode for editor scripts

* fixing errors after fast enter playmode

* fixing tools states on enter fast playmode

* changelog

* fix error on enter playmode

* Fixing tools icons not loading properly when importing the package (#668)

* remove old tests not used anymore
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