Keep data files in build, but be able to modify them from the app?

Hey there!

The title might be slightly confusing, sorry about that, I just don’t know how to condense this into one question.

What I’m trying to do is that I have data files in my assets folder (basically baked data) and I want them to be in the build, but I want the user to be able to overwrite (rebake) these files if they choose to, directly from the app. Is it possible to write to the contents of the assets folder after the app has been built? Or should I work around the problem?
One way I thought about working around it is to copy these files into the persistentDataPath on the first startup, and read from there when needed. I would like to avoid having to bake these files on the first startup, because it can take quite a while.

Thank you!

  • Alexa

Why isn’t the standard way feasible in your case?

  • check if you have a file X in your persistentDataPath, if you have, load that
  • if you don’t have X, then load the file X you have embedded in your assets, use that
  • bake any user data in the persistentDataPath in your file X

AFAIK File.Exists work on most platforms in the persistentDataPath context.

This how 99% of games and other applications work.

Isn’t this analogous to how Minecraft does its save world?

I seem to remember the save state was just the delta changes to the underlying random-seed-generated world within a given chunk.

This seems to support that:

The seed gives you the unmodified world rapidly (perhaps cached).

The deltas say what has happened to it.

If it’s good enough for minecraft…

Alright then I’ll do that then!

Thanks for the help!

  • Alexa