I'm trying to make a list of cameras that sorts itself based on a number held by a script that each camera has. Why is this code not functioning?
cams = cams.OrderByDescending(cams => cams.GetComponent<cameraLocator>().cameraZone) ;
Camera Zone is the ID number I want to sort by, cams is the list to be sorted.
Your first attempt was almost correct. You still need to convert the IOrderdEnumerable
back to a list.
cams = cams.OrderByDescending(cams => cams.GetComponent<cameraLocator>().cameraZone).ToList();