using System.Collections; using System.Collections.Generic; using UnityEditor; using UnityEngine; public class CubeHelper : MonoBehaviour { //public GameObject CubePrefab; //private const string CubeName = "Highlight"; //[MenuItem("Highlight/Add Highlight")] //public static void RecalculateColliders() //{ // var joints = FindObjectsOfType(); // foreach (HingeJoint joint in joints) // { // for (var i = 0; i < joint.transform.childCount; i++) // { // if (joint.transform.GetChild(i).name == CubeName) // { // DestroyImmediate(joint.transform.GetChild(i).gameObject); // } // } // if (joint.gameObject.activeSelf) // { // //GameObject go = Instantiate(Resources.Load(CubeName)); // //go.transform.SetParent(joint.transform); // //go.name = CubeName; // //go.transform.localScale = Vector3.one * 0.1f; // //go.transform.localPosition = Vector3.zero; // //go.transform.localRotation = Quaternion.identity; // //var h = joint.gameObject.AddComponent(); // //h.HighCube = go; // var cJoint = joint.gameObject.AddComponent(); // cJoint.connectedAnchor = joint.connectedAnchor; // cJoint.axis = joint.axis; // cJoint.anchor = joint.anchor; // cJoint.connectedBody = joint.connectedBody; // cJoint.massScale = joint.massScale; // DestroyImmediate(joint); // } // } //} }