Storing OpenSimplexNoise in a file and loading it back in

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

If I create a
var noise = OpenSimplexNoise.New()

and write it to a json file, I get something like the following

“[OpenSimplexNoise:1194]”

If I then try to assign noise to it, it assigns it as a string, rather than as OpenSimplexNoise

How would I be able to properly re assign noise from a file? Is it even possible?

:bust_in_silhouette: Reply From: exuin

Is there any reason you can’t just save the OpenSimplexNoise as a tres file? It’s a resource.

:bust_in_silhouette: Reply From: Leo LeBlanc

I don’t think you would need to store the whole object, just store the seed value via text or json (or whatever other file type you choose) you should get the same results by loading the stored seed into a newly created OpenSimplexNoise object.

Kidscancode has a great tutorial that can get you started with saving to files if you are unfamiliar.