Sort GameObjects By Integer Not Working

hi guys,

I’m trying to set up a game over menu that displays the current scores of the players in my Multiplayer game using Photon. so far everything works perfectly with the exception of the order being incorrect. I’ve tried every thing from Linq to what I currently have now:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class MULeaderboardsSCORE : MonoBehaviour {
	
	public GameObject leaderboardEntryPrefab;
	public Transform leaderboardgrid;
	public static string usernameString, facebookID = "";
	public List<GameObject> entries = new List<GameObject>();

	public void GetLeaderboard()
	{
		for (int i = 0; i < entries.Count; i++) {
			Destroy (entries *);*
  •  }*
    
  •  entries.Clear ();*
    
  •  foreach (PhotonPlayer entry in PhotonNetwork.playerList) {*
    
  •  	GameObject leaderboardEntry = Instantiate (leaderboardEntryPrefab);*
    
  •  	leaderboardEntry.transform.SetParent (leaderboardgrid, false);*
    
  •  	leaderboardEntry.GetComponent<LeaderboardEntry> ().rankString = (entries.Count + 1).ToString ();*
    
  •  	leaderboardEntry.GetComponent<LeaderboardEntry> ().usernameString = entry.customProperties ["username"].ToString ();*
    
  •  	leaderboardEntry.GetComponent<LeaderboardEntry> ().scoreString = entry.customProperties ["score"].ToString ();*
    
  •  	leaderboardEntry.GetComponent<LeaderboardEntry> ().facebookID = entry.customProperties ["FBImage"].ToString ();*
    
  •  	entries.Add (leaderboardEntry);*
    
  •  	Debug.Log ("Leaderboard Updated");*
    
  •  }*
    
  •  if (entries.Count > 0) {*
    
  •  	entries.Sort (delegate(GameObject b, GameObject a) {*
    
  •  		return (a.GetComponent<LeaderboardEntry> ().scoreInt).CompareTo (b.GetComponent<LeaderboardEntry> ().scoreInt);*
    
  •  	});*
    
  •  	Debug.Log ("Leaderboard Sorted");*
    
  •  }*
    
  • }*
    }
    can anyone tell me what I did wrong and why this script has no effect on the order of my players listed in the game over leaderboards?
    thanks in advance!!

How are you displaying the scores? Unity doesn’t care what order you’ve sorted them in your own list, they’re going to be displayed according to their transform position.