Hi, I have unrecognised extension of the file (any but not .txt), but i want to use that in StreamReader.
I also want to add that file trough Unity’s inspector, via public variable. Is there any way to do it? Is there any other variable type that I could use, instead of TextAsset ?
You can read files normally using System.IO.FIle class. You are not limited to any Unity tools for working with files. The TextAsset is what it says - an asset. It uses unity references, derives from UnityEngine.Object. It has nothing to do with file access, and it won’t be present as a file in the build.
The usual location for files that you want preserved in their original binary form in the build is the StreamingAssets folder. You can get the folder path by using Application.streamingAssetsPath and store any files that should be part of the build here. But you can also load any files from any location where the OS gives your app an access permission.
I use StreamingAssets for storing my custom config files and savegame files, and generally anything that can be changed during the game and written back to be preserved between app runs
According to Unity - Manual: Streaming Assets, “On many platforms, the streaming assets folder location is read-only.” Sounds like a bad place for save files!
As for configuration files, my current thought is to avoid this because players can find and change them. Text assets aren’t exposed in the same way.
Which is why it would be super useful if there were a way to use arbitrary extensions as text assets (.lua in my case)…