Comments (9)
The runtime documentation is available here. Here's the part about reading those files from disk.
To load a raw asset you should:
"Use PlayAssetPackRequest.GetAssetLocation()
to get an AssetLocation
object. This provides the path, offset, and size of the asset so that it can be loaded from disk."
from play-unity-plugins.
Here's an example using a file stream to load the text into a string:
FileStream assetFileStream = File.OpenRead(assetLocation.Path);
byte[] buffer = new byte[assetLocation.Size];
assetFileStream.Seek((long) assetLocation.Offset, SeekOrigin.Begin);
assetFileStream.Read(buffer, /* offset= */ 0, buffer.Length);
string fileContents = Encoding.UTF8.GetString(buffer, 0, buffer.Length);
Are you doing something similar?
from play-unity-plugins.
Thanks for raising this issue. Currently the runtime API lags behind the packaging API a bit. We are working on updating the runtime API with a method that allows you to access the raw assets inside of those packs, but that functionality isn't supported yet.
In the meantime as a workaround/hack, you can use Unity's TextAsset to have GameObjects reference arbitrary files. Then you can package those GameObjects in AssetBundles and access the files using TextAsset.bytes.
from play-unity-plugins.
Thank you for clarifying. I am currently not there yet with my project where lacking this feature would be an issue so I can wait for now.
from play-unity-plugins.
Update: We added experimental support for this in the v1.1.1 release. If you want to give it a try, you can enable the PLAY_ASSET_DELIVERY_EXPERIMENTAL preprocessor definition in player settings (see the "Platform custom #defines" section here for how to do that)
from play-unity-plugins.
@jamcohen May I know how to get Raw Asset now?
from play-unity-plugins.
@jamcohen Thanks for your help. We get the AssetLocation object but find that we can't load that file out. It would be good if you could show us some light.
This is the { path / size / offset } of the AssetLocation object { /data/app/com.DefaultCompany.TestAB-KRpgbnLxvKt8DzJ3vu3IKg==/split_assets.apk / 620847 / 2188 }. This should be a simple .txt file but we find that we could not read this file out with Readerstream using the path above.
from play-unity-plugins.
This really help!
Thanks!!
from play-unity-plugins.
Happy to help! I'll close this issue, but feel free to reopen if you're still having trouble.
from play-unity-plugins.
Related Issues (20)
- BuildBundle fails to copy symbols zip (Unity 2022.3 LTS) HOT 2
- [Play Asset Delivery] 1 Assetpack - Multiple AssetBundles HOT 3
- Issue in InAppUpdate plugin unable to detect User Interaction in App update Popup
- Android apk release play consoleGoogle Unity installation
- Screenshot (Sep 28, 2023 7:35:21 AM)
- Downloads gets stuck from Google play side
- JNI Global Reference Overflow Bug
- Duplicate class com.google.android.play.core.common.IntentSenderForResultStarte HOT 4
- App update rejected due to error on asset pack download : Error(-13) HOT 2
- BundletoolHelper.BuildApkSet doesn't sign apks
- Google Play In-App Review API - Error posting review "Expected UNIVERSAL BIT STRING, but found UNIVERSAL SEQUENCE"
- AssetModuleException: Session not found HOT 14
- Build Problem on CI by Docker
- Pad Issue After Download HOT 1
- Unity 2022.3.14f1 requires com.google.android,play:asset.delivery version 2.1.0 HOT 3
- Asset Delivery : Bundles can't restart/continue downloading after interrupting it in notification bar HOT 11
- Issue with Google Play Games PC InputSDK Integration in Unity
- Crash MissingForegroundServiceTypeException HOT 1
- Play In-App Update Plugin needs update for Android 14 compatibility HOT 11
- Unity 2021.3.34f1 used last play asset delivery libs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from play-unity-plugins.