Skip to content

Commit

Permalink
Fix crash when a static mesh has a missing material and `Write Proper…
Browse files Browse the repository at this point in the history
…ties as Static Values` is enabled. fix #60
  • Loading branch information
d4rkc0d3r committed Oct 29, 2023
1 parent 5a85c66 commit f902413
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Editor/d4rkAvatarOptimizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Material>();
foreach (var (material, index) in mats)
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {},
Expand Down

0 comments on commit f902413

Please sign in to comment.