Skip to content

Verify null material handling in Renderer.sharedMaterials access#2

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-null-materials-references
Draft

Verify null material handling in Renderer.sharedMaterials access#2
Copilot wants to merge 3 commits intomainfrom
copilot/fix-null-materials-references

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 13, 2026

Unity's Renderer.sharedMaterials can contain null entries when materials are missing. The issue reported reference errors in Quick Variant list display and material application, requesting fixes across the codebase.

Analysis Results

All sharedMaterials access points already implement proper null filtering:

QuickVariantWindow.cs

  • GetMaterials(): Filters nulls after concatenating all material sources (line 224: .Where(m => m != null))
  • OnClickCreateMaterials(): Explicit null check when applying materials (lines 175-178)

MaterialReplacerWindow.cs

  • GetRendererMaterials(): Filters nulls immediately (line 31: .Where(m => m != null))
  • OnClickApply(): Explicit null check when applying materials (lines 158-160)

MaterialReplacerRuleEditor.cs

  • GetMaterials(): Filters nulls before return (line 69: .Where(m => m != null))

No code changes required. The base commit already contains comprehensive null handling for all identified scenarios.

Original prompt

This section details on the original issue you should resolve

<issue_title>Renderer.sharedMaterials等にnullのマテリアルが含まれていると参照エラーになる問題の修正</issue_title>
<issue_description>Quick Variantの一覧表示とマテリアル適用で発生を確認した。他にもあれば合わせて修正すること。</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix reference error caused by null materials in Renderer.sharedMaterials Verify null material handling in Renderer.sharedMaterials access Feb 13, 2026
Copilot AI requested a review from kurotu February 13, 2026 03:45
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.

Renderer.sharedMaterials等にnullのマテリアルが含まれていると参照エラーになる問題の修正

2 participants