using System.Collections; using System.Collections.Generic; using UnityEditor; using UnityEngine; public class YHRemovecollider : Editor { [MenuItem("YH/Removesomething")] public static void Removecollider() { Transform[] oos = Selection.transforms; for (int i = 0; i < oos.Length; i++) { if (oos[i].childCount > 0) { SphereCollider[] meshscolliders = oos[i].GetComponentsInChildren(); Animator[] ani = oos[i].GetComponentsInChildren(); for (int j = 0; j < meshscolliders.Length; j++) { Debug.Log(meshscolliders[j].name + "collider"); DestroyImmediate(meshscolliders[j]); } for (int a = 0; a < ani.Length; a++) { Debug.Log(ani[a].name + "Animator"); DestroyImmediate(ani[a]); } } else { DestroyImmediate(oos[i].GetComponent()); DestroyImmediate(oos[i].GetComponent()); } } } }