diff options
author | chai <215380520@qq.com> | 2023-10-19 15:36:59 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2023-10-19 15:36:59 +0800 |
commit | f4a633ea5125025216cc1d260d5dbac66f6ed194 (patch) | |
tree | 2c1d70c22b712dd895afcdc41bda158b1e2ee2ae /Docs/TAB_AddDebugRigidBody.txt | |
parent | bc77bc7bc8b1a9b04ff598ff45eec0a1df5c6d8c (diff) |
*doc
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 |