- Home /
Manipulating and using .Json files at runtime.
I made a card game which uses .json files to read and edit decks.
There are a total of three scenes: Menu, Deck, and Game. In the Deck scene, the player can view the pre-created .json files and add, rename or delete any of them. I'm currently using string variables as paths to get the deck at runtime example: deckPath = Application.streamingAssetsPath + "/Decks/my_deck.json"
. I wanted to use TextAssets, but creating them in script from .json and adding them to a variable always returns a null value (none).
However, this doesn't work in the build version. The decks simply won't populate the dropdown because it can't find the path of the decks. (Even though the path is being updated in the start method with the deck present in the streamingAssetsPath
(I've tried using persistentDataPath
but to no avail)
I should note that the player can navigate between the scenes, and the main menu scene always keeps track of the loaded deck path (which is a string) as a static variable (which also doesn't load in the game scene).
So here's my ultimate question: What is the best way to handle files creation and manipulation while the scenes are running (dynamic text assets maybe ?)
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
How to read data from a text file into a collection? (JSON preferred) 1 Answer
Mac/Web buils size? 1 Answer