diff options
Diffstat (limited to 'Docs/TAB_AddDebugRigidBody.txt')
-rw-r--r-- | Docs/TAB_AddDebugRigidBody.txt | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/Docs/TAB_AddDebugRigidBody.txt b/Docs/TAB_AddDebugRigidBody.txt new file mode 100644 index 0000000..0af5869 --- /dev/null +++ b/Docs/TAB_AddDebugRigidBody.txt @@ -0,0 +1,143 @@ + +GameObject go = GameObject.Find("Player_Target"); +if (go != null) +{ + + Rigidbody[] rigs = go.transform.GetComponentsInChildren<Rigidbody>(); + for (int i = 0; i < rigs.Length; i++) + { + var rig = rigs[i]; + var comps = rig.gameObject.GetComponents<MonoBehaviour>(); + if (comps != null) + { + for (int j = 0; j < comps.Length; j++) + { + if (comps[j].GetType().Name == "DebugRigidBody" || comps[j].GetType().Name == "DebugRigidBody2") + { + UnityEngine.Object.DestroyImmediate(comps[j]); + } + } + } + Debug.Log(rig.gameObject.name); + rig.gameObject.AddComponent<DebugRigidBody>(); + } +} + + +GameObject mainCam = GameObject.Find("Main Camera"); +if (mainCam != null) +{ + var comps = mainCam.gameObject.GetComponents<MonoBehaviour>(); + if (comps != null) + { + for (int j = 0; j < comps.Length; j++) + { + if (comps[j].GetType().Name == "DebugRigidBody" || comps[j].GetType().Name == "DebugRigidBody2") + { + UnityEngine.Object.DestroyImmediate(comps[j]); + } + } + } + Debug.Log(mainCam.name); + mainCam.AddComponent<DebugRigidBody>(); +} + + +string name = "RotationTarget"; +GameObject go = GameObject.Find(name); +if (go != null) +{ + var comps = go.gameObject.GetComponents<MonoBehaviour>(); + if (comps != null) + { + for (int j = 0; j < comps.Length; j++) + { + if (comps[j].GetType().Name == "DebugRigidBody" || comps[j].GetType().Name == "DebugRigidBody2") + { + UnityEngine.Object.DestroyImmediate(comps[j]); + } + } + } + Debug.Log(go.name); + go.AddComponent<DebugRigidBody>(); +} + +string name = "AvaragePosition"; +GameObject go = GameObject.Find(name); +if (go != null) +{ + var comps = go.gameObject.GetComponents<MonoBehaviour>(); + if (comps != null) + { + for (int j = 0; j < comps.Length; j++) + { + if (comps[j].GetType().Name == "DebugRigidBody" || comps[j].GetType().Name == "DebugRigidBody2") + { + UnityEngine.Object.DestroyImmediate(comps[j]); + } + } + } + Debug.Log(go.name); + go.AddComponent<DebugRigidBody>(); +} + +string name = "CameraRotationY"; +GameObject go = GameObject.Find(name); +if (go != null) +{ + var comps = go.gameObject.GetComponents<MonoBehaviour>(); + if (comps != null) + { + for (int j = 0; j < comps.Length; j++) + { + if (comps[j].GetType().Name == "DebugRigidBody" || comps[j].GetType().Name == "DebugRigidBody2") + { + UnityEngine.Object.DestroyImmediate(comps[j]); + } + } + } + Debug.Log(go.name); + go.AddComponent<DebugRigidBody>(); +} + + +string name = "CameraRotationX"; +GameObject go = GameObject.Find(name); +if (go != null) +{ + var comps = go.gameObject.GetComponents<MonoBehaviour>(); + if (comps != null) + { + for (int j = 0; j < comps.Length; j++) + { + if (comps[j].GetType().Name == "DebugRigidBody" || comps[j].GetType().Name == "DebugRigidBody2") + { + UnityEngine.Object.DestroyImmediate(comps[j]); + } + } + } + Debug.Log(go.name); + go.AddComponent<DebugRigidBody>(); +} + + + +string name = "CameraMovement"; +GameObject go = GameObject.Find(name); +if (go != null) +{ + var comps = go.gameObject.GetComponents<MonoBehaviour>(); + if (comps != null) + { + for (int j = 0; j < comps.Length; j++) + { + if (comps[j].GetType().Name == "DebugRigidBody" || comps[j].GetType().Name == "DebugRigidBody2") + { + UnityEngine.Object.DestroyImmediate(comps[j]); + } + } + } + Debug.Log(go.name); + var drb = go.AddComponent<DebugRigidBody>(); + drb.mode = DebugRigidBody.EMode.Cube; +}
\ No newline at end of file |