From f4a633ea5125025216cc1d260d5dbac66f6ed194 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Thu, 19 Oct 2023 15:36:59 +0800 Subject: *doc --- Docs/TAB_AddDebugRigidBody.txt | 143 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 Docs/TAB_AddDebugRigidBody.txt (limited to 'Docs/TAB_AddDebugRigidBody.txt') 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(); + for (int i = 0; i < rigs.Length; i++) + { + var rig = rigs[i]; + var comps = rig.gameObject.GetComponents(); + 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(); + } +} + + +GameObject mainCam = GameObject.Find("Main Camera"); +if (mainCam != null) +{ + var comps = mainCam.gameObject.GetComponents(); + 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(); +} + + +string name = "RotationTarget"; +GameObject go = GameObject.Find(name); +if (go != null) +{ + var comps = go.gameObject.GetComponents(); + 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(); +} + +string name = "AvaragePosition"; +GameObject go = GameObject.Find(name); +if (go != null) +{ + var comps = go.gameObject.GetComponents(); + 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(); +} + +string name = "CameraRotationY"; +GameObject go = GameObject.Find(name); +if (go != null) +{ + var comps = go.gameObject.GetComponents(); + 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(); +} + + +string name = "CameraRotationX"; +GameObject go = GameObject.Find(name); +if (go != null) +{ + var comps = go.gameObject.GetComponents(); + 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(); +} + + + +string name = "CameraMovement"; +GameObject go = GameObject.Find(name); +if (go != null) +{ + var comps = go.gameObject.GetComponents(); + 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(); + drb.mode = DebugRigidBody.EMode.Cube; +} \ No newline at end of file -- cgit v1.1-26-g67d0