using System.Collections; using System.Collections.Generic; using UnityEditor; using UnityEngine; using VRTK; public class FindScriptObj : MonoBehaviour { public List targets; public Transform targetParent; [ContextMenu("FindNotMeshColiider")] public void FindNotMeshColiider() { targets = new List(); Rigidbody[] rigs = targetParent.GetComponentsInChildren(); foreach (Rigidbody item in rigs) { if (item.useGravity == true && item.isKinematic == false) { targets.Add(item.gameObject); } } /* MeshCollider[] colliders = targetParent.GetComponentsInChildren(); foreach (MeshCollider item in colliders) { if (item.sharedMesh == null) { targets.Add(item.gameObject); } } */ } //[ContextMenu("FindInteEnable")] public void FindTargets() { targets = new List(); GameObject[] allObjs = FindObjectsOfType(); foreach (GameObject obj in allObjs) { if (obj.TryGetComponent(out VRTK_InteractableObject target)) { if (target.isUsable) targets.Add(obj); } } } //[ContextMenu("Find Miss Meshes")] private void FindMissMesh() { targets = new List(); GameObject[] allObjects = GameObject.FindObjectsOfType(); MeshFilter item = null; foreach (GameObject obj in allObjects) { if (obj.TryGetComponent(out item)) { if (item.sharedMesh == null) { targets.Add(obj); } } } } } #if UNITY_EDITOR public static class FindTool { [MenuItem("Tools/FindTarget")] public static void FindTargetNode() { StepNodeBase[] stepNodeBases = GameObject.FindObjectsOfType(); foreach (StepNodeBase stepNodeBase in stepNodeBases) { if (stepNodeBase.NodeName == "拆卸开始节点") { Debug.Log(stepNodeBase.gameObject.name); break; } else { Debug.Log(stepNodeBase.gameObject.name); } } } } #endif