Skip to content

[UUM-133526] Material Editor - fix warning from GUILayout#659

Merged
thomas-tu merged 3 commits intomasterfrom
bugfix/guilayoutstate-warning
Mar 16, 2026
Merged

[UUM-133526] Material Editor - fix warning from GUILayout#659
thomas-tu merged 3 commits intomasterfrom
bugfix/guilayoutstate-warning

Conversation

@thomas-tu
Copy link
Collaborator

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

Purpose of this PR

Fix a warning thrown by the GUILayout system due to missing End gui layout calls. We exit the scope of a function early, so we need to make the End calls.

Links

Jira: UUM-133526

@thomas-tu thomas-tu self-assigned this Mar 13, 2026
@thomas-tu thomas-tu changed the title Material Editor - fix warning from GUILayout [UUM-133526] Material Editor - fix warning from GUILayout Mar 13, 2026
Copy link

@u-pr u-pr bot left a comment

Choose a reason for hiding this comment

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

Great

I have reviewed the changes and found one area for improvement regarding the handling of IMGUI layout states when returning early. Overall, the code quality is high.

🤖 Helpful? 👍/👎

@codecov-github-com
Copy link

codecov-github-com bot commented Mar 13, 2026

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
Editor/EditorCore/MaterialEditor.cs 0.00% 1 Missing ⚠️
@@           Coverage Diff           @@
##           master     #659   +/-   ##
=======================================
  Coverage   36.05%   36.06%           
=======================================
  Files         277      277           
  Lines       34909    34911    +2     
=======================================
+ Hits        12588    12589    +1     
- Misses      22321    22322    +1     
Flag Coverage Δ
probuilder_MacOS_6000.0 34.58% <0.00%> (-0.01%) ⬇️
probuilder_MacOS_6000.3 34.58% <0.00%> (-0.01%) ⬇️
probuilder_MacOS_6000.4 34.57% <0.00%> (-0.01%) ⬇️
probuilder_MacOS_6000.5 34.57% <0.00%> (-0.01%) ⬇️
probuilder_MacOS_6000.6 34.57% <0.00%> (?)

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

Files with missing lines Coverage Δ
Editor/EditorCore/MaterialEditor.cs 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

Copy link
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.

nice

@unity-kristinn
Copy link

/test_plan

@u-pr
Copy link

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 addresses a GUILayout state corruption warning (GUI Error: Invalid GUILayout state in MaterialEditor view.) in the ProBuilder Material Editor. The fix involves adding GUIUtility.ExitGUI() before an early return in Editor/EditorCore/MaterialEditor.cs, ensuring the IMGUI system correctly terminates the current layout pass after the material list is modified.

Risk Assessment

  • High Risk Areas: None identified.
  • Medium Risk Areas: None identified.
  • Low Risk Areas: Material Editor UI, specifically the material slot management.

Test Scenarios

Functional Testing

  • Verify Fix: Open the ProBuilder Material Editor (Tools > ProBuilder > Editors > Material Editor). Add several material slots, then click the red 'X' button to delete a slot. Verify that no "Invalid GUILayout state" warnings appear in the Console.
  • State Consistency: Verify that after deleting a material slot, the list updates correctly in the UI and the remaining materials are preserved.

Regression Testing

  • Data Persistence: Ensure that clicking the delete button correctly triggers SaveUserMaterials and that the changes persist after closing and reopening the Material Editor or restarting Unity.
  • Button Functionality: Verify that other buttons within the same horizontal group (the material slot selector itself) still function correctly before and after a deletion.

Edge Cases

  • Empty List: Verify behavior when deleting the last remaining material slot (if allowed by the UI).
  • Rapid Input: Rapidly click the delete button to ensure multiple ExitGUI() calls or rapid list modifications do not cause an editor crash or unexpected UI behavior.

💡 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 thomas-tu merged commit 456461e into master Mar 16, 2026
12 of 13 checks passed
@thomas-tu thomas-tu deleted the bugfix/guilayoutstate-warning branch March 16, 2026 16:43
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.

3 participants