Unity iPhone - Using the file system in my app/game?

Hi all,

My question is probably best asked by explaining what I need to do...

I am making a music based app/game where each "level" needs to pull in note-based information so that the level knows where notes should be played on the timeline. In order to do this, i've been advised that I should perhaps have a folder named "Songs" and in this folder, each song has a folder, "Song_001" for example. In a song folder you'll find files which contain note information for any given instrument. For example, drums might have the following files:

  • snare.notes
  • kick.notes
  • hihat.notes
  • crash.notes

In each of these files would be '1 note per line' and each note would have information for note timing and hit-type (accented, ghosted, ruffed for example) via a comma separated list.

The idea is that i'll load in these .notes files and parse them into dota that I can use in the game...

What I need to know is how to go about finding these files via the file system? I can build my own paths to find the files, but i couldn't find any information on how to go about actually locating files and pulling them in? Keep in mind this is for Unity iPhone. Hopefully that makes sense.

lastly, just want to say thanks for all the fantastic answers i've received in past questions, this place is amazing.

Thanks

Mat

The easiest way is to use a TextAsset. (Despite the name you can use it to read bytes as well as text.) If you really need actual file system access, use the System.IO classes and file members. Keep in mind that what's available depends on what version of .net you're using (e.g., using 1.1 means that ReadAllBytes isn't available). You'd also need to make use of Application.dataPath when doing this.