using UnityEngine; using UnityEngine.UI; using UnityEditor; using System.Collections; using System.Collections.Generic; using System.IO; using System.Text; /// /// 禁用DisableBoxCollider /// public class DisableBoxCollider { /// /// 资源包后缀 /// private static string AssetBundleURE = ".unity3d"; /// /// 禁用BoxCollider /// [MenuItem("Tools/DisableBoxCollider")] private static void DisableBoxColliderFun() { GameObject obj = Selection.activeObject as GameObject; if (obj == null) { Debug.LogError("未选中任何物体!!!"); return; } BoxCollider[] bcs = obj.GetComponentsInChildren(true); for (int i = 0; i < bcs.Length; i++) { bcs[i].enabled = false; // MonoBehaviour.DestroyImmediate(bcs[i]); } AssetDatabase.SaveAssets(); } }