diff --git a/Packages/nadena.dev.modular-avatar/Editor/AvatarProcessor.cs b/Packages/nadena.dev.modular-avatar/Editor/AvatarProcessor.cs index bb23905c..b19805cb 100644 --- a/Packages/nadena.dev.modular-avatar/Editor/AvatarProcessor.cs +++ b/Packages/nadena.dev.modular-avatar/Editor/AvatarProcessor.cs @@ -171,6 +171,8 @@ namespace nadena.dev.modular_avatar.core.editor AssetDatabase.StartAssetEditing(); nowProcessing = true; + RemoveMissingScriptComponents(avatarGameObject); + ClearEditorOnlyTagComponents(avatarGameObject.transform); BoneDatabase.ResetBones(); @@ -296,6 +298,12 @@ namespace nadena.dev.modular_avatar.core.editor Debug.Log($"Processed avatar " + avatarGameObject.name + " in " + sw.ElapsedMilliseconds + "ms"); } + private static void RemoveMissingScriptComponents(GameObject avatarGameObject) + { + foreach (var child in avatarGameObject.GetComponentsInChildren(true)) + GameObjectUtility.RemoveMonoBehavioursWithMissingScript(child.gameObject); + } + private static void ClearEditorOnlyTagComponents(Transform obj) { // EditorOnly objects can be used for multiple purposes - users might want a camera rig to be available in @@ -381,4 +389,4 @@ namespace nadena.dev.modular_avatar.core.editor } } } -} \ No newline at end of file +}