UnityRef is currently in early development. Some features may be incomplete and/or not functioning.

UNITYREF

Your Pit Stop For Solving ANYTHING in Unity

assets

[StreamingAssets] Expose Modifiable Configuration and Game Files to End Users

Solution

editor scriptingmoddingasset pipeline

Unity 2018.x - Unity 6.3.x

Published 20 days ago

Issue

Resources and Addressables systems pack assets into binary formats, preventing users from editing configuration files or modding data in the installation directory. Developers require a method to maintain raw file formats that are easily accessible via standard file explorers without proprietary unpacking tools.

Explanation
  1. Create a folder named StreamingAssets in your project’s Assets directory.
  2. Place any text, JSON, or configuration files into this folder.
  3. Use the Application.streamingAssetsPath property to resolve the platform-specific file path.
  4. Access files using the Application.streamingAssetsPath with standard System.IO methods for desktop builds.

Files placed in this special directory are copied to the build destination verbatim without compression or indexing. This allows users to navigate to the build folder and open your configuration files in any text editor.

The Application.streamingAssetsPath provides a read-only source on many platforms. If your script needs to save changes back to the file, first check if the platform allows writing to that directory. On Windows, Mac, and Linux, StreamingAssets remains a physical folder, but on mobile, it is packed into the build archive.

Additional Tips

  • For Android, use UnityWebRequest to read from Application.streamingAssetsPath because files are inside a compressed .apk or .aab container.
  • If users need to save data that persists between updates, copy files from Application.streamingAssetsPath to Application.persistentDataPath on the first launch.
  • Always use Path.Combine to join Application.streamingAssetsPath with filenames to ensure cross-platform path compatibility.

TL;DR

To enable user modification of game files, utilize the StreamingAssets folder and the Application.streamingAssetsPath property to preserve raw file structures post-build.


Related Posts Haven't quite found a solution to your problem? We think these posts might help you.

Content inspired by a Unity discussion post.