public void printOrder() { foreach (MechPrefab prefab in _prefabList) { // Debug.Log (" EL NOMBRE ES " + prefab.gameObject.name + " El parent es " + prefab.gameObject.transform.parent + " y su mount es " + prefab ); MechPrefab[] grandChildren = prefab.GetComponentsInChildren<MechPrefab>(); foreach(MechPrefab grandChild in grandChildren) { //Debug.Log (" EL Tiene un child de " + grandChild.gameObject.name); //Debug.Log (" La cantidad de childs es " + grandChildren.Length); } //List<MechPrefab> c = GetParts(); MechPrefab test = getMechPart(prefab.gameObject.name); GameObject go = Instantiate(test.gameObject); Debug.Log (" el que encontro es " + test); if (miniManager == null) { GameObject x; x = GameObject.Find ("CopyCat"); x.AddComponent<JuedyManager> (); miniManager = x.GetComponent<JuedyManager> (); Debug.Log (" Se creo el minimanager" ); } //miniManager.mechParts = mechParts; foreach (MechPrefab x in mechParts) { // manager.mechParts.Add (x); } Debug.Log ("antes" + miniManager.rootGo); miniManager.SpawnPart(GetMechPart(test.gameObject.transform.name)); Debug.Log ("despues" + miniManager.rootGo); /* } if(_prefabList.Count > 0) { for(int x = 0 ; x < _prefabList.Count ; x++) foreach(Transform child in _prefabList[x].transform) { MechPrefab oldPrefab = child.GetComponent<MechPrefab>(); if(oldPrefab) { Debug.Log (" EL NOMBRE ES " + child.gameObject.name); MechPrefab[] grandChildren = oldPrefab.GetComponentsInChildren<MechPrefab>(); foreach(MechPrefab grandChild in grandChildren) { //RemovePart(grandChild); } //RemovePart(oldPrefab); //Destroy(child.gameObject); } } } /*/ } }
public void printOrder() { foreach (MechPrefab prefab in _prefabList) { // Debug.Log (" EL NOMBRE ES " + prefab.gameObject.name + " El parent es " + prefab.gameObject.transform.parent + " y su mount es " + prefab ); MechPrefab[] grandChildren = prefab.GetComponentsInChildren <MechPrefab>(); foreach (MechPrefab grandChild in grandChildren) { //Debug.Log (" EL Tiene un child de " + grandChild.gameObject.name); //Debug.Log (" La cantidad de childs es " + grandChildren.Length); } //List<MechPrefab> c = GetParts(); MechPrefab test = getMechPart(prefab.gameObject.name); GameObject go = Instantiate(test.gameObject); Debug.Log(" el que encontro es " + test); if (miniManager == null) { GameObject x; x = GameObject.Find("CopyCat"); x.AddComponent <JuedyManager> (); miniManager = x.GetComponent <JuedyManager> (); Debug.Log(" Se creo el minimanager"); } //miniManager.mechParts = mechParts; foreach (MechPrefab x in mechParts) { // manager.mechParts.Add (x); } Debug.Log("antes" + miniManager.rootGo); miniManager.SpawnPart(GetMechPart(test.gameObject.transform.name)); Debug.Log("despues" + miniManager.rootGo); /* * * * * * * } * * * * * if(_prefabList.Count > 0) * { * for(int x = 0 ; x < _prefabList.Count ; x++) * * foreach(Transform child in _prefabList[x].transform) * { * MechPrefab oldPrefab = child.GetComponent<MechPrefab>(); * * * * * if(oldPrefab) * { * * Debug.Log (" EL NOMBRE ES " + child.gameObject.name); * * MechPrefab[] grandChildren = oldPrefab.GetComponentsInChildren<MechPrefab>(); * * foreach(MechPrefab grandChild in grandChildren) * { * * * //RemovePart(grandChild); * } * * //RemovePart(oldPrefab); * //Destroy(child.gameObject); * } * } * } * /*/ } }