public static bool ContainerToActionList(Action act, GameObject obj) { bool nonEmpty = false; for (int i = 1; i < obj.transform.childCount; i++) { GameObject child = obj.transform.GetChild(i).gameObject; if (child.GetComponent <UIActionType>().type == Action.ActionType.For) { Action forAct = ActionManipulator.createAction(child.GetComponent <UIActionType>().type); forAct.nbFor = int.Parse(child.transform.GetChild(0).transform.GetChild(1).GetComponent <InputField>().text); if (forAct.nbFor > 0 && child.transform.childCount > 1 && ContainerToActionList(forAct, child)) { ActionManipulator.addAction(act, forAct); nonEmpty = true; } } else if (child.GetComponent <UIActionType>().type == Action.ActionType.If) { Action IfAct = ActionManipulator.createAction(child.GetComponent <UIActionType>().type); IfAct.ifEntityType = child.transform.GetChild(0).GetChild(1).GetChild(1).GetComponent <Dropdown>().value; IfAct.ifDirection = child.transform.GetChild(0).GetChild(1).GetChild(2).GetComponent <Dropdown>().value; IfAct.range = int.Parse(child.transform.GetChild(0).GetChild(1).GetChild(3).GetComponent <InputField>().text); IfAct.ifNot = (child.transform.GetChild(0).GetChild(2).GetComponent <Dropdown>().value == 1); IfAct.ifValid = false; if (child.transform.childCount > 1 && ContainerToActionList(IfAct, child)) { ActionManipulator.addAction(act, IfAct); nonEmpty = true; } } else { ActionManipulator.addAction(act, ActionManipulator.createAction(child.GetComponent <UIActionType>().type)); nonEmpty = true; } } return(nonEmpty); }