VonnCC
VonnCC

Reputation: 457

Application.dataPath doesn't give the right path

Good day, I feel like Application,.dataPath is useless unless you are doing it on Editor, I built my application on Windows and Mac, both says that my file is not found. But when I do it on Editor everything is okay. I'm trying to load a JSON file from my Assets root folder. What is the best way to load my JSON File as a FILE, not get its content and read it.

SomeClass.SomeMethod(Path.Combine(Application.dataPath, "jsonFile.json")

Upvotes: 0

Views: 2519

Answers (1)

Lotan
Lotan

Reputation: 4283

Application.dataPath is the path to your assets folder.

This path is only available on Editor, not in build. If you want something that works in both sides, Editor and Build, should be done inside the folder StreamingAssets.

Upvotes: 3

Related Questions