My project is for mobile, I would like to read data from an external file (not accessible once the game is compiled): there is a lot of data and not everything is needed all the time so I don’t want to overload the project by setting a ton of variable up.
I just want to get my data when needed.
I don’t mind the format or structure of the file, I will deal with it.
I’ve understood that I won’t be able to write inside the file but I will use the Storage if I need to write something, I’m ok with that.
Can you help me get something similar done with GD5? Working on Mobile?
Thanks!
Hey! As the native platform got deprecated, the storage now uses actions from the Javascript/Web platform. The web cannot directly interface with the filesystem (imagine if scam websites could read all your data?) like before, so the storage extension now uses cookies. It’s exclusively for Storing data, that means it starts as a clean “filesystem simulation” with nothing on it. You can read and write it but you cannot use it to access existing files.
To access the filesystem on computers running the executable version a new extension have been created, the Filesystem extension. Unfortunately it doesn’t support (yet?) mobile filesystem.
Until an extension to load project files on android too get created, a workaround would be to convert your file to json, load it as a JSON resource, and load it with the network extension (just type the filename with extension as the url, no protocol, slashes or anything else), and use the action to convert JSON to a variable.
Removed the “/” before the name of my file, I tried to change the structure of my json file to this:
“null” :
“[{ “first”: 12,“second”: 66,“string”: “nothing”,“structured”: { “ChildVariable”: 1,“ChildVariable2”: 2,“ChildVariable3”: 3,“ChildVariable4”: 4 } } ]”
Thanks arthuro, I figured it out.
I think I’ll make a quick tutorial in the next days to help people who have the same issue as I had.
I’ll put a link to the tutorial here so please don’t SOLVE it yet.
Best,
Sweet, sorry I took so long to answer.
I’ll make a tutorial anyway, looks like it’s finally not such a rare problem and for someone totally new to game dev, it ain’t easy.