My Json file is not appearing in “FOTO_DATA/Resources”.
I’m using Resources.Load(...) and the file is in “Assets/Resources”. I used Debug.Log(Resources.Load(...)) to make sure the file is been loaded sucessfully.
The game has no problem in Unity Editor, but when i build it this error is shown: Could not find file “C:\Users------\Desktop\FOTO_Data\Resources\relations.json”
When i paste relations.json on the folder the game works fine.
Make sure everything is correct and matches proper caps and such. Your code itself seems fine, however, I do see you are loading into “fileJson” but then you are convert “arquivoJson” toString. That’s perhaps because you just dropped the file into the variable for testing.
Otherwise, I use the same code, just a different json asset, to do my json.
To get the contents of a TextAsset, you’d want to use aquivoJson.text or fileJson.text, not ToString(). ToString() will just give you the name of the file. I don’t think that’s the particular problem you’re having here, but it’s certainly a problem.
Huh… weird. That’s A) not how ToString used to work with TextAssets, B) inconsistent with how ToString works with literally any other UnityEngine.Object-based class, and C) not what the documentation for the function says (according to the docs, the TextAsset.ToString inherits the standard UnityEngine.Object ToString method). But, a quick test confirms that that is indeed what it does.
I’ve bugreported it as a problem with the documentation.