diff --git a/CHANGELOG.md b/CHANGELOG.md index bf146cd..8dba290 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v3.2.1 +### Bug Fixes +* Fix crash when a static mesh has a missing material and `Write Properties as Static Values` is enabled. [(more)](https://github.com/d4rkc0d3r/d4rkAvatarOptimizer/issues/60) + ## v3.2.0 ### Changes * Remove option `Merge Regardless of Blend Shapes`. It is now always enabled because VRChat now uses unity 2022. diff --git a/Editor/d4rkAvatarOptimizer.cs b/Editor/d4rkAvatarOptimizer.cs index 0870861..37f2dbc 100644 --- a/Editor/d4rkAvatarOptimizer.cs +++ b/Editor/d4rkAvatarOptimizer.cs @@ -3131,7 +3131,7 @@ private void OptimizeMaterialsOnNonSkinnedMeshes() continue; DisplayProgressBar($"Optimizing materials on {meshRenderer.name}"); var path = GetPathToRoot(meshRenderer); - var mats = meshRenderer.sharedMaterials.Select((material, index) => (material, index)).ToList(); + var mats = meshRenderer.sharedMaterials.Select((material, index) => (material, index)).Where(m => m.material != null).ToList(); var alreadyOptimizedMaterials = new HashSet(); foreach (var (material, index) in mats) { diff --git a/package.json b/package.json index ad3b94d..1bcce3c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "d4rkpl4y3r.d4rkavataroptimizer", "displayName": "d4rkAvatarOptimizer", - "version": "3.2.0", + "version": "3.2.1", "unity": "2019.4", "description": "An optimizer aiming to reduce mesh & material count and more of VRChat 3.0 avatars.", "dependencies": {},