- File needs to have .bytes extension.
- File needs to be in a folder named Resources.
- You load the file as a TextAsset with Resources.Load(path).
- You pass the file.bytes to a Stream to a BinaryReader.
- Boom. Data.
I use a binary file to hold all possible CUBEs and their corresponding values. When the game starts I read the file and parse the data into a static array so any class that needs the info can easily acquire it. I am using binary instead of XML because I am targeting mobile and switching from XML to binary saved me about a MB (removed one XML file and the System.XML namespace).
However binary is not very easy for me to read and write because I am just a lame human, so I use a local XML file to keep track of CUBE info as I create the game. I then use a tool I created in Unity that finds that file and parses the XML into an array of the info that I need, which I then take and convert to binary and save to the .bytes file for the app to read when the game starts.