Linq OrderBy GameObject's name Numerical

For example:

My Unsorted list

  • 13,543
  • 1,034
  • 2,652

My Sorted list

  • 1,034
  • 13,543
  • 2,652

Trying to achieve:

  • 1,034
  • 2,652
  • 13,543

Currently using this line of code:

highScores = highScores.OrderBy (go => go.name).ToList ();

That would mean your highscore value is being stored as a string, and LINQ is trying to sort alphabetically. Try:

highScores = highScores.OrderBy (go => float.Parse(go.name)).ToList ();