I'm trying to figure out how to sort a nested List in Unity. I have my:
[System.Serializable]
public class HistoryRecordList
{
public int recordDate;
public string record;
}
And my list here:
public class InputMachine : MonoBehaviour
{
public List<HistoryRecordList> historyRecords = new List<HistoryRecordList>();
public void AddToHistory(int ID, string description)
{
HistoryRecordList list = new HistoryRecordList();
list.recordDate = ID;
list.record = description;
historyRecords.Add(list);
}
}
I like to sort the list "historyRecords" by recordDate; I know, there is a list.Sort() function but I don't know how to apply it to a nested list. Maybe someone knows how to do it?