Skip to content

Commit

Permalink
Add cleanup pass and exception reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
bdunderscore committed Sep 20, 2023
1 parent a837008 commit 3011203
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -14,6 +16,11 @@ class PluginDefinition : Plugin<PluginDefinition>
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);
Expand Down Expand Up @@ -56,6 +63,13 @@ protected override void Configure()
animator.avatar = avatar;
}
});
seq.Run("Purge ModularAvatar components", ctx =>
{
foreach (var component in ctx.AvatarRootTransform.GetComponentsInChildren<AvatarTagComponent>(true))
{
UnityEngine.Object.DestroyImmediate(component);
}
});
});

InPhase(BuildPhase.Optimizing)
Expand Down

0 comments on commit 3011203

Please sign in to comment.