// Get parent public GenericValues(Component _ele) { //Get parent TabComponent _parent = _ele.transform.parent.GetComponent <TabComponent>(); if (_parent != null) { parent = _parent.tab; } else { parent.geometry = new TabType.Geometry(); parent.geometry.tabContainer.rect.width = Screen.width; parent.geometry.tabContainer.rect.height = Screen.height; parent.geometry.tabBody.rect.width = Screen.width; parent.geometry.tabBody.rect.height = Screen.height; parent.data = new TabType.Data(); parent.data.type = SubType.TabType.Panel; } //Get values by component BranchValuesComponent _branchValues = _ele.GetComponentInParent <BranchValuesComponent>(); if (_ele.GetType() == typeof(TabComponent)) { ele = TabType.Generic(_ele.GetComponents <TabComponent>()[0].tab); componentPosition = ele.geometry.tabContainer.position; branchPosition = _branchValues.tab.geometry.tabContainer.position; componentSize = ele.geometry.tabContainer.size; branchSize = _branchValues.tab.geometry.tabContainer.size; } else if (_ele.GetType() == typeof(ButtonComponent)) { ele = ButtonType.Generic(_ele.GetComponents <ButtonComponent>()[0].button); componentPosition = ele.geometry.buttonBody.position; branchPosition = _branchValues.button.geometry.buttonBody.position; componentSize = ele.geometry.buttonBody.size; branchSize = _branchValues.button.geometry.buttonBody.size; } else if (_ele.GetType() == typeof(TextareaComponent)) { ele = TextareaType.Generic(_ele.GetComponents <TextareaComponent>()[0].textarea); componentPosition = ele.geometry.textareaBody.position; branchPosition = _branchValues.textarea.geometry.textareaBody.position; componentSize = ele.geometry.textareaBody.size; branchSize = _branchValues.textarea.geometry.textareaBody.size; } }