- Home /
Accessing binary files non-sequentially in c# on Android
I'm building a game that will have multiple large (multi MB) binary data files that I don't want to load into RAM all at once.
Here is an example of what I have that works on windows but not on my target device which is Android.
byte[] bytes = new byte[1000];
FileStream fs = new FileStream (Application.dataPath + "/MyData", FileMode.Open, FileAccess.Read , FileShare.Read);
fs.Seek (2177, SeekOrigin.Begin);
fs.Read (bytes, 0, 1000);
I need an equivalent method that will work on Android.
I've looked at Resources.Load() & BinaryReader() but they don't seem to give me an option to read a specific part of the file, and my searches have not found anything useful.
Any help would be appreciated.
P.S. Even though I'm new to unity I don't think I've overlooked anything that should be obvious, but if I have I'm sure you will let me know :).
Your answer
![](https://koobas.hobune.stream/wayback/20220613175713im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Access android IR blaster 0 Answers
Changing view based on device 0 Answers
changing text using .text works in editor but not on android device 0 Answers