delete early component. that. yknow. deletes... early...?
This commit is contained in:
parent
54c79328f6
commit
c361ad2945
11 changed files with 135 additions and 0 deletions
38
DeleteEarly/Editor/DeleteEarlyPlugin.cs
Normal file
38
DeleteEarly/Editor/DeleteEarlyPlugin.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue