Hi everybody ! I’m a begginer with unity and c# and sorry for my bad english ^^
i would like to know how it’s can be possible to simplify my code. i want to get the valu of multiple child and add themself
i do something like this :
DEF = (SlotPanel.GetChild(0).GetComponent<StatsSlots>().DEF) + (SlotPanel.GetChild(1).GetComponent<StatsSlots>().DEF) + (SlotPanel.GetChild(2).GetComponent<StatsSlots>().DEF)+
(SlotPanel.GetChild(3).GetComponent<StatsSlots>().DEF)+ (SlotPanel.GetChild(4).GetComponent<StatsSlots>().DEF) + (SlotPanel.GetChild(5).GetComponent<StatsSlots>().DEF) +
(SlotPanel.GetChild(6).GetComponent<StatsSlots>().DEF) + (SlotPanel.GetChild(7).GetComponent<StatsSlots>().DEF);
but i think that is a complicate and longer way ^^
So if someone can give me a trick ?
Thx for reading me, have a good night ![]()