I’m somewhat of a noob to Unity and scripting in it, and I am trying to be able to read and modify a text file. I have been pointed to the link below by this helpful Unity Answers community, and I am hoping that you could do the same for this question of mine.
The link to TextAssets is here.
I am basically wondering what I am supposed to do with that from a start. I am not trying to get you to “write my scripts” but I would appreciate an example or a link to help about this.
I just want a quick script that will read the text file into a variable, and an other one that will take a variable and edit the file.
TextAssets only exist for text files present in the build. As with any other files included in the build, they cease to exist as distinct files, which removes aspects like “path” (either its hooked up on a monobehaviour or must be in resources to be present in the build at all) or “file” which would be required if you want to write to it at runtime.
For runtime write to the file you would use System.IO in detail System.IO.File
Depending on what data you need to write, PlayerPrefs can be an option but there are relevant things to keep in mind on that end that might make it unfavorable (they are per version based so if you change the version in the player settings, the old prefs will no longer be used)