Can I use an array from a script in a folder?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Paolinsky

I am generating a .gd file with the data of the world which I store in an array, what I want to do is that through code I can access this array at any time, I would use the autoload option but since the file does not exist before run the project I do not know what to do, also the script is not atached to any node so I can not use it through one.

There surely is a way to solve this, but why this complicated. Why doesn’t it exist just empty. And why does it have to be a .gd file and not just a text file (like json)? Think that would be easier.

Also: Autoloads are just scripts being saved in nodes as child of the root node. So you can just add ones like these in game and attach you script as already explained for this question.

Good luck.

Jowan-Spooner | 2019-05-10 20:01