delete early component. that. yknow. deletes... early...?

This commit is contained in:
Lillith Rose 2026-01-07 23:17:31 -05:00
parent 54c79328f6
commit c361ad2945
11 changed files with 135 additions and 0 deletions

View file

@ -0,0 +1,38 @@
using gay.lilyy.DeleteEarly;
using nadena.dev.ndmf;
using UnityEngine;
[assembly: ExportsPlugin(typeof(DeleteEarlyPlugin))]
namespace gay.lilyy.DeleteEarly
{
public class DeleteEarlyPlugin : Plugin<DeleteEarlyPlugin>
{
public override string DisplayName => "Delete Early";
public override string QualifiedName => "gay.lilyy.DeleteEarly";
protected override void Configure()
{
InPhase(BuildPhase.FirstChance).Run("DeleteEarly", ctx =>
{
var configs = ctx.AvatarRootObject.GetComponentsInChildren<DeleteEarlyConfig>(true);
if (configs == null || configs.Length == 0)
return;
foreach (var config in configs)
{
if (config == null)
continue;
GameObject targetToDelete = config.targetObject != null ? config.targetObject : config.gameObject;
if (targetToDelete != null)
{
Object.DestroyImmediate(targetToDelete);
}
}
});
}
}
}