void OnGUI()
 {
     if (GUILayout.Button("Add/Remove Sword"))
     {
         if (swordInstance == null)
         {
             Transform hand = SearchHierarchyForBone(targetCharacter.transform, "RightHandAttachPoint");
             swordInstance = (GameObject)Instantiate(swordPrefab);
             swordInstance.transform.parent        = hand;
             swordInstance.transform.localPosition = Vector3.zero;
             swordInstance.transform.localRotation = Quaternion.identity;
             swordInstance.transform.localScale    = Vector3.one;
             GameObject[] objsToAdd = new GameObject[1] {
                 swordInstance.GetComponentInChildren <MeshRenderer>().gameObject
             };
             skinnedMeshBaker.AddDeleteGameObjects(objsToAdd, null);
             skinnedMeshBaker.Apply();
         }
         else if (skinnedMeshBaker.CombinedMeshContains(swordInstance.GetComponentInChildren <MeshRenderer>().gameObject))
         {
             GameObject[] objsToDelete = new GameObject[1] {
                 swordInstance.GetComponentInChildren <MeshRenderer>().gameObject
             };
             skinnedMeshBaker.AddDeleteGameObjects(null, objsToDelete);
             skinnedMeshBaker.Apply();
             Destroy(swordInstance);
             swordInstance = null;
         }
     }
     if (GUILayout.Button("Add/Remove Hat"))
     {
         if (hatInstance == null)
         {
             Transform hand = SearchHierarchyForBone(targetCharacter.transform, "HeadAttachPoint");
             hatInstance = (GameObject)Instantiate(hatPrefab);
             hatInstance.transform.parent        = hand;
             hatInstance.transform.localPosition = Vector3.zero;
             hatInstance.transform.localRotation = Quaternion.identity;
             hatInstance.transform.localScale    = Vector3.one;
             GameObject[] objsToAdd = new GameObject[1] {
                 hatInstance.GetComponentInChildren <MeshRenderer>().gameObject
             };
             skinnedMeshBaker.AddDeleteGameObjects(objsToAdd, null);
             skinnedMeshBaker.Apply();
         }
         else if (skinnedMeshBaker.CombinedMeshContains(hatInstance.GetComponentInChildren <MeshRenderer>().gameObject))
         {
             GameObject[] objsToDelete = new GameObject[1] {
                 hatInstance.GetComponentInChildren <MeshRenderer>().gameObject
             };
             skinnedMeshBaker.AddDeleteGameObjects(null, objsToDelete);
             skinnedMeshBaker.Apply();
             Destroy(hatInstance);
             hatInstance = null;
         }
     }
     if (GUILayout.Button("Add/Remove Glasses"))
     {
         if (glassesInstance == null)
         {
             Transform hand = SearchHierarchyForBone(targetCharacter.transform, "NoseAttachPoint");
             glassesInstance = (GameObject)Instantiate(glassesPrefab);
             glassesInstance.transform.parent        = hand;
             glassesInstance.transform.localPosition = Vector3.zero;
             glassesInstance.transform.localRotation = Quaternion.identity;
             glassesInstance.transform.localScale    = Vector3.one;
             GameObject[] objsToAdd = new GameObject[1] {
                 glassesInstance.GetComponentInChildren <MeshRenderer>().gameObject
             };
             skinnedMeshBaker.AddDeleteGameObjects(objsToAdd, null);
             skinnedMeshBaker.Apply();
         }
         else if (skinnedMeshBaker.CombinedMeshContains(glassesInstance.GetComponentInChildren <MeshRenderer>().gameObject))
         {
             GameObject[] objsToDelete = new GameObject[1] {
                 glassesInstance.GetComponentInChildren <MeshRenderer>().gameObject
             };
             skinnedMeshBaker.AddDeleteGameObjects(null, objsToDelete);
             skinnedMeshBaker.Apply();
             Destroy(glassesInstance);
             glassesInstance = null;
         }
     }
 }