From 3f0741c30fb938ced4298a0368c991cd771fa3be Mon Sep 17 00:00:00 2001 From: Thomas Tu Date: Fri, 13 Mar 2026 09:37:26 -0400 Subject: [PATCH 1/3] Add missing End GUILayout calls --- Editor/EditorCore/MaterialEditor.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Editor/EditorCore/MaterialEditor.cs b/Editor/EditorCore/MaterialEditor.cs index 7cb14468d..2d3cc3a88 100644 --- a/Editor/EditorCore/MaterialEditor.cs +++ b/Editor/EditorCore/MaterialEditor.cs @@ -361,6 +361,8 @@ void OnGUI() System.Array.Copy(materials, 0, temp, 0, materials.Length - 1); materials = temp; SaveUserMaterials(materials); + GUILayout.EndHorizontal(); + GUILayout.EndScrollView(); return; } GUI.backgroundColor = Color.white; From 43ea314785d726ccd93cbb67fca0188180847c78 Mon Sep 17 00:00:00 2001 From: Thomas Tu Date: Fri, 13 Mar 2026 09:45:04 -0400 Subject: [PATCH 2/3] Add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d5186fc1..eb7527410 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - [UUM-133861] Fixed "Look rotation viewing vector is zero" log being spammed when holding shift while using a create tool such as Create Sprite. +- [UUM-133526] Material Editor: fixed a warning (`GUI Error: Invalid GUILayout state in MaterialEditor view.`) that was thrown when deleting an extra material slot. - Fixed warnings related to obsolete API calls with Unity 6.4 and onwards. ## [6.0.9] - 2026-01-30 From 7d5ca3c1d643398c47079200dc7387670c4ff015 Mon Sep 17 00:00:00 2001 From: Thomas Tu Date: Fri, 13 Mar 2026 13:45:50 -0400 Subject: [PATCH 3/3] Use ExitGUI() to leave the IMGUI scope early --- Editor/EditorCore/MaterialEditor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Editor/EditorCore/MaterialEditor.cs b/Editor/EditorCore/MaterialEditor.cs index 2d3cc3a88..4729d4b2c 100644 --- a/Editor/EditorCore/MaterialEditor.cs +++ b/Editor/EditorCore/MaterialEditor.cs @@ -361,8 +361,8 @@ void OnGUI() System.Array.Copy(materials, 0, temp, 0, materials.Length - 1); materials = temp; SaveUserMaterials(materials); - GUILayout.EndHorizontal(); - GUILayout.EndScrollView(); + + GUIUtility.ExitGUI(); return; } GUI.backgroundColor = Color.white;