Reading in .txt files – formatting stuff

A bit jumbled but here’s what I’ve been working on with this :

Things that are tripping me up:

Spaces are meaningful in C#.  I keep thinking I can have strings come in like this       “sh”, “tr”, “g”     buuuuut that space in the middle KILLS it and it’s not interpreting each quoted section as a string but instead everything in between the separators as strings.  Eesh!

Having unity correctly interpret a tab delimited file is tricky.  It doesn’t seem like I can edit the file correctly inside unity, and that’s sad (#todo – is there a way to do this? I keep adding tabs and it keeps not interpreting them).  Even editing inside textedit doesn’t seem to give it the tabs.  And then Google drive doesn’t export as a .txt.  So the only thing that seems to be working right now is export as .txt from Excel (ugh), which means that line breaks won’t be interpreted right, so then open in TextEdit, resave, and then use THAT file in Unity.  There has to be a better way?

Ohh okay.  So I just figured out that StreamReader, which I keep seeing referenced (http://answers.unity3d.com/questions/279750/loading-data-from-a-txt-file-c.html, http://answers.unity3d.com/questions/12598/help-me-about-reading-txt-file.html) requires Systems.IO .

This doesn’t seem to be a thing that Unity typically does, but unsure.

So for the first time, the Unity Cookbook is really looking worthwhile.  Signed up for the Safari trial so I can look at it online: https://www.safaribooksonline.com/library/view/unity-4x-cookbook/9781849690423/ch08s03.html

If I like the trial I’ll decide if I want it in book form or in internet form. Could see it either way.

HOLY COW the new problem I’ve been having is that there’s an extra line at the end.  Ah.  Deleted it, now things are happy again.

Oh – looks like I *can* make a .txt in GoogleDrive? (#todo insert link that described how)

Also my script doesn’t like it when I end a column in the separator that I use later. Huh. (; in this case).

#todo – ways to adjust font in this thing?

Leave a Reply

Your email address will not be published. Required fields are marked *