42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
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<SphereCollider>();
|
|
Animator[] ani = oos[i].GetComponentsInChildren<Animator>();
|
|
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<SphereCollider>());
|
|
DestroyImmediate(oos[i].GetComponent<Animator>());
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|