Hi I have used AES to encrypt a series of properties and have stored them in a text file that I have placed in the resources folder of my project. I can read the text file correctly in the editor using…
string[] text = File.ReadAllLines ("Assets/Resources/Test.txt", Encoding.Unicode);
…but I can’t figure out how to do it on an IOS device. I have searched a lot and tried a few things but failed. Can someone please point me in the right direction?
You need to use Resources.Load in a build. If you open the bundle on the device (with iExplorer/etc) you will see that that file does not exist! All files in any folder below a “Resources” folder anywhere in the Assets folder are put into a special Unity file (pre-imported to a native binary format where applicable for faster loading) at build time.
TextAsset file = Resources.Load("Test.txt") as TextAsset;
string text = file.text; // If that doesn't work, you can get the raw bytes with .bytes and convert