示例#1
0
    public void OnChangedValueFormation()
    {
        string        formation = menu.GetFormation(roulant.GetComponent <Dropdown>().value);
        List <string> units     = new List <string>(formation.Split(' '));

        for (int i = 0; i < units.Count; i++)
        {
            GameObject unitCanvas = canvas.transform.GetChild(i + 1).gameObject;
            Sprite     sprite     = menu.GetSpriteFromName(units[i]);
            unitCanvas.transform.GetChild(0).GetComponent <Image>().sprite = sprite;
            unitCanvas.transform.GetChild(1).GetComponent <Text>().text    = units[i];
        }
    }