Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I've gotten my MonoGame/Android game to the point where I can preload a bunch of audios before-hand (this avoids weird behaviour where the sound is not ready at the instant of need). I do this by doing something like:

string[] audioFiles = new string[] { "game-over", "hit", ... }
foreach (string audio in audioFiles) {
  someContentManager.Load<SoundEffect>("Audio/" + audio);
}

The problem is that this requires manually listing all of the files. I would like to somehow read the directory contents.

I tried various combinations of Directory.GetFiles. I can list out the contents of /, but that doesn't help me at all.

How can I dynamically read/load the contents of a certain directory?

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.