public List <string> FindWidgetTypes() { List <string> types = new List <string>(); #if NGUI UIRect[] rectArr = this.gameObject.GetComponents <UIRect>(); foreach (UIRect rect in rectArr) { types.Add(rect.GetType().FullName); } UIWidgetContainer[] container = this.gameObject.GetComponents <UIWidgetContainer>(); foreach (UIWidgetContainer widget in container) { types.Add(widget.GetType().FullName); } UIInput input = this.gameObject.GetComponent <UIInput>(); if (input) { types.Add(input.GetType().FullName); } UIWrapContent wrap = this.gameObject.GetComponent <UIWrapContent>(); if (wrap) { types.Add(wrap.GetType().FullName); } #elif UGUI Graphic[] graphics = this.gameObject.GetComponents <Graphic>(); foreach (Graphic g in graphics) { types.Add(g.GetType().Name); } UIBehaviour[] uiBehavs = this.gameObject.GetComponents <UIBehaviour>(); foreach (UIBehaviour uib in uiBehavs) { types.Add(uib.GetType().Name); } #endif //if (types.Count <= 0) { types.Add("GameObject"); types.Add("Transform"); } return(types); }
public List <string> FindWidgetTypes() { List <string> types = new List <string>(); UIRect[] rectArr = this.gameObject.GetComponents <UIRect>(); foreach (UIRect rect in rectArr) { types.Add(rect.GetType().FullName); } UIWidgetContainer[] container = this.gameObject.GetComponents <UIWidgetContainer>(); foreach (UIWidgetContainer widget in container) { types.Add(widget.GetType().FullName); } UIInput input = this.gameObject.GetComponent <UIInput>(); if (input) { types.Add(input.GetType().FullName); } UIWrapContent wrap = this.gameObject.GetComponent <UIWrapContent>(); if (wrap) { types.Add(wrap.GetType().FullName); } //if (types.Count <= 0) { types.Add("GameObject"); types.Add("Transform"); } return(types); }
public List <string> FindWidgetTypes() { List <string> types = new List <string>(); #if NGUI UIRect[] rectArr = this.gameObject.GetComponents <UIRect>(); foreach (UIRect rect in rectArr) { types.Add(rect.GetType().FullName); } UIWidgetContainer[] container = this.gameObject.GetComponents <UIWidgetContainer>(); foreach (UIWidgetContainer widget in container) { types.Add(widget.GetType().FullName); } UIInput input = this.gameObject.GetComponent <UIInput>(); if (input) { types.Add(input.GetType().FullName); } UIWrapContent wrap = this.gameObject.GetComponent <UIWrapContent>(); if (wrap) { types.Add(wrap.GetType().FullName); } #elif UGUI Text txt = this.gameObject.GetComponent <Text>(); if (txt) { types.Add(txt.GetType().Name); } Image img = this.gameObject.GetComponent <Image>(); if (img) { types.Add(img.GetType().Name); } Button btn = this.gameObject.GetComponent <Button>(); if (btn) { types.Add(btn.GetType().Name); } InputField inputField = this.gameObject.GetComponent <InputField>(); if (inputField) { types.Add(inputField.GetType().Name); } Toggle tog = this.gameObject.GetComponent <Toggle>(); if (tog) { types.Add(tog.GetType().Name); } Slider slider = this.gameObject.GetComponent <Slider>(); if (slider) { types.Add(slider.GetType().Name); } Scrollbar scrollbar = this.gameObject.GetComponent <Scrollbar>(); if (scrollbar) { types.Add(scrollbar.GetType().Name); } ScrollRect rect = this.gameObject.GetComponent <ScrollRect>(); if (rect) { types.Add(rect.GetType().Name); } #endif //if (types.Count <= 0) { types.Add("GameObject"); types.Add("Transform"); } return(types); }