diff --git a/Packages/nadena.dev.modular-avatar/Editor/PluginDefinition/PluginDefinition.cs b/Packages/nadena.dev.modular-avatar/Editor/PluginDefinition/PluginDefinition.cs index 14f32443..7b7adea5 100644 --- a/Packages/nadena.dev.modular-avatar/Editor/PluginDefinition/PluginDefinition.cs +++ b/Packages/nadena.dev.modular-avatar/Editor/PluginDefinition/PluginDefinition.cs @@ -1,4 +1,6 @@ -using nadena.dev.ndmf; +using System; +using nadena.dev.modular_avatar.editor.ErrorReporting; +using nadena.dev.ndmf; using nadena.dev.ndmf.animation; using nadena.dev.ndmf.fluent; using UnityEngine; @@ -14,6 +16,11 @@ class PluginDefinition : Plugin public override string QualifiedName => "nadena.dev.modular-avatar"; public override string DisplayName => "Modular Avatar"; + protected override void OnUnhandledException(Exception e) + { + BuildReport.LogException(e); + } + protected override void Configure() { Sequence seq = InPhase(BuildPhase.Resolving); @@ -56,6 +63,13 @@ protected override void Configure() animator.avatar = avatar; } }); + seq.Run("Purge ModularAvatar components", ctx => + { + foreach (var component in ctx.AvatarRootTransform.GetComponentsInChildren(true)) + { + UnityEngine.Object.DestroyImmediate(component); + } + }); }); InPhase(BuildPhase.Optimizing)