mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-02-07 14:22:47 +08:00
chore: remove all components with missing script (#404)
* chore: remove all components with missing script * Traverse disabled gameobjects when purging missing scripts Co-authored-by: bd_ <bd_@nadena.dev>
This commit is contained in:
parent
6591f35a78
commit
39da3b6742
@ -171,6 +171,8 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
AssetDatabase.StartAssetEditing();
|
AssetDatabase.StartAssetEditing();
|
||||||
nowProcessing = true;
|
nowProcessing = true;
|
||||||
|
|
||||||
|
RemoveMissingScriptComponents(avatarGameObject);
|
||||||
|
|
||||||
ClearEditorOnlyTagComponents(avatarGameObject.transform);
|
ClearEditorOnlyTagComponents(avatarGameObject.transform);
|
||||||
|
|
||||||
BoneDatabase.ResetBones();
|
BoneDatabase.ResetBones();
|
||||||
@ -296,6 +298,12 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
Debug.Log($"Processed avatar " + avatarGameObject.name + " in " + sw.ElapsedMilliseconds + "ms");
|
Debug.Log($"Processed avatar " + avatarGameObject.name + " in " + sw.ElapsedMilliseconds + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void RemoveMissingScriptComponents(GameObject avatarGameObject)
|
||||||
|
{
|
||||||
|
foreach (var child in avatarGameObject.GetComponentsInChildren<Transform>(true))
|
||||||
|
GameObjectUtility.RemoveMonoBehavioursWithMissingScript(child.gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
private static void ClearEditorOnlyTagComponents(Transform obj)
|
private static void ClearEditorOnlyTagComponents(Transform obj)
|
||||||
{
|
{
|
||||||
// EditorOnly objects can be used for multiple purposes - users might want a camera rig to be available in
|
// EditorOnly objects can be used for multiple purposes - users might want a camera rig to be available in
|
||||||
|
Loading…
Reference in New Issue
Block a user