- Home /
Read external files from resources
Hello everyone
I'm developing an application with Unity in VR, I need to read a filename, which inserts the user, to be uploaded within the application and other 2-3 options that always the user could choose. I had thought of an initial menu in which to put that data but it is not practical for a VR solution. So I had thought of creating a ' setting ' file where the user, before starting the application, inserts the options, the name and the path of the file from which to load the data. But I do not know how to read a file that is outside the resources of the Unity project. Also how can I create this file setting so that it is always in the same location after I Build the project and is visible within the EXE folder? Would anyone know how to help me? Or maybe give me some advice on how to proceed? Thanks in advance.
Answer by Bonfire-Boy · Feb 06, 2019 at 04:50 PM
Yes, with a Standalone Windows build (you don't mention your platform but I'm assuming on the basis of your use of "EXE"), you can do exactly that, using Application.dataPath
We do this with a VR app I'm working on at the moment.
Settings are stored in a sqlite database file alongside the .exe file, which we load using Application.dataPath+"/../"+filename
.
The app itself can change the settings, but you can also just load the file into a sqlite browser and modify them that way, or copy a differently set-up db file, all of which is very handy for QA.
And of course it means we can easily change the default settings or deploy differently configured versions just by tweaking the DB file before zipping up the build folder for distribution.
By the way we also have an initial settings screen of the sort that you reject. Why is that not practical?
Thank you very much for the suggestion of Application.dataPath. it's just what I was looking for.
As for the initial settings screen is inadequate for me because I have problems with the raycast of the canvas with HTC Vive, so the user should launch the APP, use mouse and keyboard to enter data and then move to VR.
I guess I misunderstood. That's exactly what our settings screen is like - a different scene with just a UI in which people set things up before entering the VR scene. It is an "initial menu", but not in VR. It's easier for the end-user than editing a file (some of our end-users are not computer literate), but the editing-a-file solution is also available for power users and configuring a deployment.
my application is for a scientific research. the configuration file is a very simple X$$anonymous$$L where to insert 3 strings with the appropriate comments on what to insert. but of course I understand that if we talk about applications aimed at all the configuration file is not the best choice because many people do not know how to modify it. In my case it will be fine in the future I will insert an initial menu :-) thank you very much for the advice :-)
Your answer
![](https://koobas.hobune.stream/wayback/20220612191225im_/https://answers.unity.com/themes/thub/images/avi.jpg)