All-in-One Solution for Indie Game Development · Empowering Indie Developers' Dreams
Documentation · Quick Start · QQ Group: 467608841 / 233840761
English | 简体中文 | 繁體中文 | 日本語 | 한국어
Access StreamingAssets directly in a uniform and thread-safe way with tiny overhead. Based on BetterStreamingAssets, provides System.IO-style APIs for all platforms including Android APK.
All public APIs are annotated with [Preserve] to prevent stripping in IL2CPP builds.
This library primarily serves as a sub-library for GameFrameX.
Choose one of the following methods:
-
Edit your Unity project's
Packages/manifest.jsonand add thescopedRegistriessection:{ "scopedRegistries": [ { "name": "GameFrameX", "url": "https://gameframex.upm.alianblank.uk", "scopes": [ "com.gameframex" ] } ], "dependencies": { "com.gameframex.unity.readassets": "1.2.0" } }scopescontrols which packages are resolved through this registry. Only packages whose names start withcom.gameframexwill be fetched from it. -
Add to
manifest.jsondependencies:{ "com.gameframex.unity.readassets": "https://github.com/gameframex/com.gameframex.unity.readassets.git" } -
Use Package Manager in Unity with Git URL:
https://github.com/gameframex/com.gameframex.unity.readassets.git -
Clone the repository into your Unity project's
Packagesdirectory. It will be loaded automatically.
No manual initialization needed — APIs auto-initialize on first call. To initialize in advance:
// Manual initialization (main thread)
BlankReadAssets.Initialize();
// Get StreamingAssets root path
string root = BlankReadAssets.Root;// Read all bytes
byte[] data = BlankReadAssets.ReadAllBytes("Foo/bar.data");
// Read as stream
using (var stream = BlankReadAssets.OpenRead("Foo/bar.data"))
{
// read from stream...
}
// Read all text
string text = BlankReadAssets.ReadAllText("Foo/config.xml");
// Read all lines
string[] lines = BlankReadAssets.ReadAllLines("Foo/data.txt");// Check existence
bool exists = BlankReadAssets.FileExists("Config/settings.json");
bool dirExists = BlankReadAssets.DirectoryExists("Config");
// List files
string[] allXmls = BlankReadAssets.GetFiles("/", "*.xml", SearchOption.AllDirectories);
string[] configs = BlankReadAssets.GetFiles("Config", "*.xml");// Synchronous
var bundle = BlankReadAssets.LoadAssetBundle(path);
// Asynchronous
var bundleOp = BlankReadAssets.LoadAssetBundleAsync(path);// Initialize with an external APK (for testing Android builds in Editor)
BlankReadAssets.InitializeWithExternalApk("/path/to/app.apk");
// Initialize with custom directories
BlankReadAssets.InitializeWithExternalDirectories(dataPath, streamingAssetsPath);- Keep all file names in StreamingAssets lowercase
- Do not use non-ASCII characters in file names
WebGL is not supported.
See CHANGELOG.md for details.
| Package | Description |
|---|---|
| (无) | - |
- QQ Group: 467608841 / 233840761
See LICENSE.md for license information.