User Tools

Site Tools


data_files

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
data_files [2022/06/26 02:26] justindata_files [2022/06/26 02:26] justin
Line 2: Line 2:
 ---- ----
  
-Although it should be considered an experimental feature at this time and requires a bit of manual setup, it's possible to access custom data stored in JSON files from [[script|scripts]]. To do so, you must first create a subfolder named "data" within your game's project folder and place the desired JSON file into that folder. When [[exporting your game]], the editor will automatically include any files in the data folder having the .json extension.+Although it requires a bit of manual setup, it's possible to access custom data stored in JSON files from [[script|scripts]]. To do so, you must first create a subfolder named "data" within your game's project folder and place the desired JSON file into that folder. When [[exporting your game]], the editor will automatically include any files in the data folder having the .json extension.
  
 As a simple example, let's say you wanted to maintain a list of [[item|items]] that the [[player character]] should begin the game with without needing to update your game's [[startup script]] every time the list changes. In this scenario, you could create a JSON file within the data folder named "start_items.json" that looks something like this, with an array of [[item]] IDs corresponding to the desired [[item|items]]. As a simple example, let's say you wanted to maintain a list of [[item|items]] that the [[player character]] should begin the game with without needing to update your game's [[startup script]] every time the list changes. In this scenario, you could create a JSON file within the data folder named "start_items.json" that looks something like this, with an array of [[item]] IDs corresponding to the desired [[item|items]].
data_files.txt · Last modified: 2022/06/26 02:27 by justin