I'm literally a couple lines of code away from pushing out a Unity app and I'm running into an issue I have fought half a day to beat.
What I have:
What's wrong:
Since this is meant to be a mobile game for iOS and Android ~ while the code completely works within Unity, I obviously get an error when running the app on a mobile device because it Application.dataPath doesn't work.
~
I've read that I need to use Resource.Load -- read it in as a TextAsset etc. but by doing this I'll get an exception like: "you can inherently convert TextAsset to string []" which is like, the entire point.
I'm baffled because I know it shouldn't be this complicated...
What I have:
Code:
int[][] LoadLevelObjects(int sLevel,int cLevel,string type,string objRefNum,int pageH,int pageW)
{
int[][] lvl = new int[pageHeight][];
string[] lines = System.IO.File.ReadAllLines(Application.dataPath + "/Resources/Spikes/S" + sLevel + ".txt");
string[] cloudLines = System.IO.File.ReadAllLines(Application.dataPath + "/Resources/Clouds/C" + cLevel + ".txt");
What's wrong:
Since this is meant to be a mobile game for iOS and Android ~ while the code completely works within Unity, I obviously get an error when running the app on a mobile device because it Application.dataPath doesn't work.
~
I've read that I need to use Resource.Load -- read it in as a TextAsset etc. but by doing this I'll get an exception like: "you can inherently convert TextAsset to string []" which is like, the entire point.
I'm baffled because I know it shouldn't be this complicated...