I’m trying to make a system that looks in a directory to find files of a certain type and load them onto a display. In my code, I had already found the files, but I want to do the reading and loading of the file in another method:
void GetWorlds () {
if (Directory.Exists(Application.DataPath + "\Worlds")) {
string worldsFolder = Application.DataPath + "\Worlds";
DirectoryInfo d = new DirectoryInfo(worldsFolder);
foreach (var file in d.GetFiles("*.cubes"))
{
DisplayWorldData(file.);
}
} else {
File.Create(Application.DataPath + "\Worlds");
return;
}
}
I don’t quite know how to find the location of the file already specified to be able to send its information to the other method “DisplayWorldData”. Help please!