using UnityEngine; using UnityEditor; using System.Linq; using System.Collections.Generic; using System.Text; public class SetShowTestTool : EditorWindow { [MenuItem("Tools/SetShowTest Tool")] public static void ShowWindow() { EditorWindow.GetWindow(typeof(SetShowTestTool)); } void OnGUI() { GUILayout.Label("SetShowTest Tool", EditorStyles.boldLabel); if (GUILayout.Button("SetShowTest As True")) { SetShowTest(true); } if (GUILayout.Button("SetShowTest As False")) { SetShowTest(false); } } private void SetShowTest(bool isTest) { GameObject[] objs = Selection.gameObjects; foreach (var obj in objs) { if (obj.transform.childCount == 0) { ShowBoxCollider sbc = obj.GetComponent(); if (sbc != null) { sbc.Test = isTest; } } else { for (int i = 0; i < obj.transform.childCount; i++) { ShowBoxCollider sbc = obj.transform.GetChild(i).GetComponent(); if (sbc != null) { sbc.Test = isTest; } } } } } }