- Home /
iPhone build doesn't copy existing files in Application.dataPath or .persistantDataPath?!
This is really making me bang my head against the wall! I can't use a TextAsset because I'm loading an .ini (.txt works, but the parser needs a full path) and I can never get the file to be included in the iPhone build. Works great in the Editor!
I tried using both Application.dataPath and Application.persistantDataPath, but since I'm only trying to read data that's already there (I am not writing anything to these folders on startup), it can never find it when I build to the iPhone because the file doesn't exists, even if I put it in the "Resources" folder!
It blows my mind how complicated it is to read a already existing file on the iPhone without using a internet address or a TextAsset!
Am I missing something? I thought everything you put in the Resources folder was included in the final build? If so, then:
StreamReader reader = new StreamReader(Application.dataPath + "/Resources/Upgrades.ini");
should load fine on the iPhone build, correct? I always get the following error:
An exception was thrown by the type initializer for UpgradeSettings ---> System.IO.IsolatedStorage.IsolatedStorageException: Could not find a part of the path "/var/mobile/Applications/71B40B89-36BE-43D6-B69D-5D02A7E5AFE3/braaapgame.app/Data/Resources/Upgrades.ini".
I do not want to use XML (in which case using a TextAsset works wonders), but it looks like I might have to after all???
Any help would be, as always, greatly appreciated! Thanks for your time... Stephane
Answer by sendel76 · Sep 09, 2011 at 11:25 AM
I am not sure, but may be trying to put the streaming assets in "/Assets/StreamingAssets" instead of "/Assets/Resources". May this is only for streaming videos - but may be not.
if you dont want to load a stream, try using "LoadResouce" function:
string filename="Upgrades.ini";
TextAsset myTextAsset = LoadResource(filename) as TextAsset;
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
A* Pathfinding Bug: Dictionary Key Not Found Exception 1 Answer
How to get Resources filepath on Android device? 2 Answers
build android apk that contain Resource XML 0 Answers
How would I create a Pacman enemy in 2D? 0 Answers