Hi. I’m very new to Unity, and working on a small project with it as part of a class. I’ve run into a bit of a problem with figuring out how to access certain assets of mine. My team and I are building a small game, and I built a system for communicating narrative to the players through text boxes (like how they do in Fire Emblem). I built this as a script that utilizes a Stream Reader that reads off of .txt files, so that my teams writer could easily write something up and incorporate it into the game. As of now, it finds the file to read by building the filepath from Application.dataPath and concatenating on “/TextFiles/something.txt”.
This works just fine in editor, but apparently when you build an executable with Unity it repackages all of the assets. How am I supposed to access those files?
You can still read txt files from Application.dataPath but those files don’t copy to your build location automatically. You have to either copy them there yourself or write a “build” script that will do it for you.
Check out the StreamingAssets folder as another alternative.