summaryrefslogtreecommitdiff
path: root/Docs/TAB_AddJointDebug.txt
blob: e8de30605f90e8078d74b85970beafadcbc32e3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
string name = "Armature_Target";
GameObject go = GameObject.Find(name);
if (go != null)
{

    var comps = go.GetComponentsInChildren<MonoBehaviour>();
    if (comps != null)
    {
        for (int j = 0; j < comps.Length; j++)
        {
            if (comps[j].GetType().Name == "DebugRigidBody")
            {
                UnityEngine.Object.DestroyImmediate(comps[j]);
            }
        }
    }

    var joints = go.GetComponentsInChildren<FollowRig>();
    if(joints != null)
    {
        for(int i = 0; i < joints.Length; i++)
        {
            Debug.Log(joints[i].gameObject.name);
            joints[i].gameObject.AddComponent<DebugRigidBody>();
        }
    }

}