I'm basing my code on that found in this article:
http://danielsaidi.w...es-in-a-folder/
though I've adjusted it slightly for my own purposes.
Here's the method I'm using:
public void LoadContent(ContentManager contentManager, List<Model> li)
{
DirectoryInfo dir = new DirectoryInfo(contentManager.RootDirectory);
if (!dir.Exists)
throw new DirectoryNotFoundException()
FileInfo[] files = dir.GetFiles("*.fbx");
foreach (FileInfo file in files)
{
string key = Path.GetFileNameWithoutExtension(file.Name);
li.Add(contentManager.Load<Model>(key));
}
}
The code runs just fine but doesn't add any model files to the list. There are definitely 4 fbx files in my content folder. I even tried adding them in the project (which I'd assumed wouldn't be necessary). Hope someone can help me out, I really don't wanna have to constantly change the code!
Thanks