/// <summary> /// add a line to the canva /// </summary> /// <param name="txt">the txt that will appear in the line of the canva</param> /// <param name="C">the canva getting updated</param> private void AddLine(string txt, Canvas C, int deletedItems) { GameObject parent = C.gameObject; int linecount = GameObjectHelper.FindNumberOfChildsWithTag(parent, "UiLine-Empty") + GameObjectHelper.FindNumberOfChildsWithTag(parent, "UiLine") - deletedItems; GameObject newButton = (GameObject)Instantiate(Resources.Load("MesPrefabs/UiLine"), new Vector3(0, -linecount * spacing, 0), Quaternion.identity); RectTransform rt = newButton.GetComponent <RectTransform>(); rt.sizeDelta = new Vector2(widthButton, heightButton); newButton.transform.SetParent(C.transform, false); newButton.GetComponentInChildren <TMP_Text>().text = txt; newButton.GetComponentInChildren <TMP_Text>().fontSize = tailleCaracteres; newButton.GetComponentInChildren <TMP_Text>().color = Color.red; newButton.tag = txt == "" ? "UiLine-Empty" : "UiLine";//*/ }