How do I make assets accessible to players for modding?

My game includes image files and json configuration files that I would like to make accessible in the deployed game’s folder structure so that players can easily edit or swap them out.

I have considered/tried the following approaches:

  • My initial approach was to use the Resources folder and code such as Resources.Load<TextAsset>("Rules.json"). Of course, this did not work as the resources folder is compiled during builds.
  • I investigated the Addressables and AssetBundle features, but they do not seem aimed at solving this problem.
  • After asking around, I went for using .NET’s own file methods, going for code like File.ReadAllText(Application.dataPath + Rules.json). This seems like it will work, but such files are still not deployed automatically and would have to manually be copied over.
  • It seems that the StreamingAssets folder exists for this, since the manual advertises that its contents are copied verbatim on the target machine. I assume that its contents should be read as in the previous point, with non-Unity IO calls like File.ReadAllText(Application.streamingAssetsPath + Rules.json)?

So yeah, what is the ‘canonical’ approach for this? And with that approach, is it still possible to get the affected files as assets (e.g. something similar to Resources.Load<Sprite>(path)), or is it necessary to use .NET IO methods to read the files and then manually turn them into Unity objects?

You’ll need to use .NET IO. Assets are something that can only be created in the Unity editor.

Using streaming assets path is good for this if you’re trying to provide default files that the user can edit.

Alright, thanks.