Skip to content

Commit

Permalink
fix: optimizing phase not executed even when VRCFury isn't installed
Browse files Browse the repository at this point in the history
Closes: #129
  • Loading branch information
bdunderscore committed Jan 28, 2024
1 parent 7c82432 commit 169b22f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

### Changed
- Reverted the optimizing phase to being invoked by Apply on Play when VRCFury is not installed (#135)

### Removed

Expand Down
12 changes: 10 additions & 2 deletions Editor/ApplyOnPlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

#region

using System;
using System.Linq;
using nadena.dev.ndmf.config;
using nadena.dev.ndmf.runtime;
using UnityEditor;
Expand Down Expand Up @@ -62,9 +64,15 @@ private static void MaybeProcessAvatar(ApplyOnPlayGlobalActivator.OnDemandSource
{
var avatar = RuntimeUtil.FindAvatarInParents(component.transform);
if (avatar == null) return;

var furyInstalled = AppDomain.CurrentDomain.GetAssemblies()
.Any(a => a.GetName().Name == "VRCFury");

// Skip optimizing the avatar as we might have VRCFury or similar running after us.
AvatarProcessor.ProcessAvatar(avatar.gameObject, BuildPhase.Transforming);
// Skip optimizing the avatar if VRCFury is installed, as VRCFury will run after optimizations
// and might be broken by e.g. blendshape removal, etc.
var lastPhase = furyInstalled ? BuildPhase.Transforming : BuildPhase.Optimizing;

AvatarProcessor.ProcessAvatar(avatar.gameObject, lastPhase);
}
}

Expand Down

0 comments on commit 169b22f

Please sign in to comment.