From 05f2276aabe4f613c8010a734e5f6e679b6e3865 Mon Sep 17 00:00:00 2001 From: bd_ Date: Wed, 17 May 2023 20:19:05 +0900 Subject: [PATCH] chore: adjust PreventStripTagObjects to avoid stripping non-MA components as well --- .../Editor/PreventStripTagObjects.cs | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/Packages/nadena.dev.modular-avatar/Editor/PreventStripTagObjects.cs b/Packages/nadena.dev.modular-avatar/Editor/PreventStripTagObjects.cs index f16c0df9..972a4882 100644 --- a/Packages/nadena.dev.modular-avatar/Editor/PreventStripTagObjects.cs +++ b/Packages/nadena.dev.modular-avatar/Editor/PreventStripTagObjects.cs @@ -1,10 +1,12 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using System.Reflection; using UnityEditor; using UnityEngine; using VRC.SDKBase; using VRC.SDKBase.Editor.BuildPipeline; +using Object = UnityEngine.Object; namespace nadena.dev.modular_avatar.core.editor { @@ -43,14 +45,19 @@ namespace nadena.dev.modular_avatar.core.editor } } - foreach (var editoronly in avatarGameObject.GetComponentsInChildren(true)) - { - if (editoronly == null || editoronly is AvatarTagComponent) - { - continue; - } + return true; + } + } - Object.DestroyImmediate((Component) editoronly); + internal class ReplacementRemoveIEditorOnly : IVRCSDKPreprocessAvatarCallback + { + public int callbackOrder => Int32.MaxValue; + + public bool OnPreprocessAvatar(GameObject avatarGameObject) + { + foreach (var component in avatarGameObject.GetComponentsInChildren(true)) + { + Object.DestroyImmediate(component as Object); } return true;