using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; public class LeaderboardDeathmatch : MonoBehaviour { public Transform ListParent; public void Populate(PlayerNetwork[] list){ for(int i=0;i < ListParent.childCount; i++){ if(list.Length > i){ ListParent.GetChild(i).gameObject.SetActive(true); ListParent.GetChild(i).GetChild(0).GetComponent().text = list[list.Length-1-i].username; ListParent.GetChild(i).GetChild(1).GetComponent().text = list[list.Length-1-i].kills.ToString(); ListParent.GetChild(i).GetChild(2).GetComponent().text = list[list.Length-1-i].deaths.ToString(); ListParent.GetChild(i).GetChild(3).GetComponent().text = list[list.Length-1-i].assists.ToString(); }else{ ListParent.GetChild(i).gameObject.SetActive(false); } } } }