So I have a saves folder where all the XML save files live. I was going to load the files using a dropdown in the UI, however I have a problem. I don’t know how to read the file names individually in the directory. I’ve tried using the path class and the directory class, but no luck. Any help would be greatly appreciated
Figured it out, here it is:
DirectoryInfo dir = new DirectoryInfo(filePath);
FileInfo[] info = dir.GetFiles("*.*");
foreach (FileInfo f in info)
{
Debug.Log(f.ToString());
}
It uses the DirectoryInfo class to get to the directory, then uses the FileInfo class to get the files. Then it uses a foreach to split the array. You can do whatever you want in the forech block, I just put a debug statement to prove that it works