IEnumerator GetBodyParts() { customBodyElement.Clear(); for (int i = 0; i < customPartMask.transformCount; i++) { if (customPartMask.GetTransformActive(i)) { var newCustomBodyElement = new CustomBodyElement(); newCustomBodyElement.name = customPartMask.GetTransformPath(i); newCustomBodyElement.bodyElement = transform.Find(customPartMask.GetTransformPath(i)); if (newCustomBodyElement.bodyElement == null) { Debug.Log("Could not find"); continue; } else { newCustomBodyElement.startScale = Vector3.one; if (newCustomBodyElement.bodyElement.GetComponent <SkinnedMeshRenderer>()) { customBodyElement.Add(newCustomBodyElement); } } } } yield return(null); }
void GetBodyParts() { customBodyElement.Clear(); for (int i = 0; i < customPartMask.transformCount; i++) { if (customPartMask.GetTransformActive(i)) { var newCustomBodyElement = new CustomBodyElement(); newCustomBodyElement.name = customPartMask.GetTransformPath(i); newCustomBodyElement.bodyElement = transform.Find(customPartMask.GetTransformPath(i)); newCustomBodyElement.startScale = Vector3.one; if (!newCustomBodyElement.bodyElement.GetComponent <SkinnedMeshRenderer>()) { customBodyElement.Add(newCustomBodyElement); } } } }
// Use this for initialization void Start() { for (int i = 0; i < mask.transformCount; i++) { if (mask.GetTransformActive(i)) { var newCustomBodyElement = new CustomBodyElement(); newCustomBodyElement.name = mask.GetTransformPath(i); newCustomBodyElement.bodyElement = transform.Find(mask.GetTransformPath(i)); if (!newCustomBodyElement.bodyElement.GetComponent <SkinnedMeshRenderer>()) { customBodyElement.Add(newCustomBodyElement); } } } for (int i = 0; i < customBodyElement.Count; i++) { var newSlider = Instantiate(slider, sliderParent); //newSlider.GetComponentInChildren<Text>().text = customBodyElement[i].name; sliders.Add(newSlider.GetComponent <Slider>()); } }