- Home /
Dynamic repositioning of Vertical Layout Group every frame issue
I'm making an RPG with party members who have accumulating speed scores every frame.
On the UI, I have a bar 'Called TimerList' which is a vertical layout group of 'Timers_Entry' class GameObjects, that are supposed to show the order of players who have the most speed currently, and update this information every frame.
I have managed to reorder the layout dynamically to my specification, but for some reason it will not update the order every frame as I intend. This is my code for a function running in Update() constantly:
public void updatePositions()
{
TimerList = TimerList.OrderBy(go => go.GetComponent<Timers_Entry>().TimersEntryPlayer.speedTotal).ToList();
for (int i = 0; i < TimerList.Count; i++)
{
TimerList[i].transform.SetSiblingIndex(i);
}
}
Any help with this would be much appreciated as it's driving me nuts, thank you :)
Your answer
![](https://koobas.hobune.stream/wayback/20220612231706im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Trouble with ZXing QR Scanning 0 Answers
UI doesn't render after scene reload. 0 Answers
UI Button Link breaking after scene load 0 Answers
Pass through control on UI elements? 0 Answers