[StreamingAssets] Expose Modifiable Configuration and Game Files to End Users
Solution
Unity 2018.x - Unity 6.3.x
Published 20 days ago
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.
- Create a folder named
StreamingAssetsin your project’sAssetsdirectory. - Place any text, JSON, or configuration files into this folder.
- Use the
Application.streamingAssetsPathproperty to resolve the platform-specific file path. - Access files using the
Application.streamingAssetsPathwith standardSystem.IOmethods 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
UnityWebRequestto read fromApplication.streamingAssetsPathbecause files are inside a compressed .apk or .aab container. - If users need to save data that persists between updates, copy files from
Application.streamingAssetsPathtoApplication.persistentDataPathon the first launch. - Always use
Path.Combineto joinApplication.streamingAssetsPathwith 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.