Skip to content

fix: prevent light icon loading as gray square#1717

Merged
willeastcott merged 5 commits intomainfrom
fix-icon-gray-square
Feb 5, 2026
Merged

fix: prevent light icon loading as gray square#1717
willeastcott merged 5 commits intomainfrom
fix-icon-gray-square

Conversation

@willeastcott
Copy link
Contributor

Summary

  • Fix icons sometimes appearing as gray squares due to race condition in texture loading
  • Restructure icon texture loading to create materials without opacityMap initially
  • Load textures asynchronously and set opacityMap when ready
  • Check material.opacityMap before rendering icons

Test plan

  • Verified fix by adding artificial delay to texture loading
  • Confirmed icons no longer appear as gray squares
  • Icons appear correctly once textures load

Fixed #1703

Icons were sometimes appearing as gray squares because their textures were used before the images had finished loading asynchronously.

This fix restructures the icon texture loading to create materials without opacityMap initially, load textures asynchronously, and check material.opacityMap before rendering icons.

Fixed #1703
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a race condition where entity icons would occasionally appear as gray squares in the viewport. The issue occurred when materials were created with textures that hadn't finished loading yet.

Changes:

  • Restructured texture loading to be fully asynchronous, creating materials without textures initially
  • Added guard logic to prevent rendering icons until their textures are fully loaded
  • Converted material storage from plain objects to Maps for better type safety

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

willeastcott and others added 3 commits February 5, 2026 15:09
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@willeastcott willeastcott merged commit 3237868 into main Feb 5, 2026
3 checks passed
@willeastcott willeastcott deleted the fix-icon-gray-square branch February 5, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Light icon loads as gray square

2 participants