Comments (5)
I strongly advise against upper case letters when targeting any Android-based system. Check README please. I am not sure about adding files to Streaming Assets at runtime, either. I don't have experience with that particular platform, but on every platform I worked with there were other folders you should keep non-build data in.
BSA is not meant to be used with full paths, as these can't be generalized across different platforms. If your specific platform does not keep Streaming Assets in an archive, you can just use regular System.IO to get what you need. A combination of Application.streamingAssetsPath
and a path obtained from BSA should also do.
from betterstreamingassets.
Thanks for the reply @gwiazdorrr
In the meantime, I've been trying out a lot of different combinations. I used filesArray = BetterStreamingAssets.GetFiles("/", "*.*", SearchOption.AllDirectories)
to return file paths. This returns the correct file path relative to the assets
folder (APK version of Streaming Assets).
The problem with that is that the string it returns doesn't seem to be recognized. To resolve this issue I've been using BetterStreamingAssets.Root
to return the full file path and combine them using Path.Combine(BetterStreamingAssets.Root, str
str being a string from filesArray inside of a for-each loop.
The problem I am now struggling with is that when I throw the Path.Combine
file path in File.Exists()
it returns false.
I've tried about 10-20 different variations of file paths and all get stuck on this.
File path examples:
/jar:file:///data/app/~~ohWEDtnAvxpfkPlepzLUAw==/com.FAT100.StarterApp-YVkJYOYlhDkfapwE8Sxktg==/base.apk!/assets/Containers/obj_models/0.obj
/data/app/~~ohWEDtnAvxpfkPlepzLUAw==/com.FAT100.StarterApp-YVkJYOYlhDkfapwE8Sxktg==/base.apk/assets/Containers/ob_models/0.obj
from betterstreamingassets.
If you see stuff like jar:file:///
, it means that it points to inside of an archive, not a standalone file. File.Exists
does peek into archive.
from betterstreamingassets.
@gwiazdorrr
Ah I see, I was unaware of that…
Could you perhaps give an example path derived from me example paths that would be accepted in File.Exists()
?
This is the final issue in my project and I’ve been struggling with it for weeks…
from betterstreamingassets.
Please read more about Streaming Assets: https://docs.unity3d.com/Manual/StreamingAssets.html
On Android platforms Streaming Assets are read only, hosted inside an archive. BSA allows you to enumerate them and read them directly, but they still won't be available as standalone files. If whatever you need Streaming Assets for accepts streams or path + file offset, you can make it work with BSA.
What you are experiencing is a fairly common misconception due to the fact that for some platforms and, more crucially, in the editor you are allowed to access and modify Streaming Assets with regular System.IO.
from betterstreamingassets.
Related Issues (20)
- Special characters support HOT 1
- SubReadOnlyStream can Seek but cannot set Position HOT 3
- BetterStreamingAssets.DirectoryExists returns false HOT 1
- Does it works with WebGL? HOT 1
- Oh sir, Does it works with IOS? HOT 1
- How about make this plugin as a "Package" in "Package Manager"? HOT 9
- Question about file name lowercase HOT 3
- WebGL? HOT 5
- GetDirectories would be great HOT 1
- (BSA_TestScene) System.UriFormatException when opening trying to test paths in APK file? HOT 6
- not worked on assetbundle with offset HOT 1
- exception when using Unity Patch functionality HOT 1
- [Android] Initialize failed with unauthorized access exception. HOT 3
- Access folder in streamingAssets folder in Android HOT 1
- Is it support obb/aab file HOT 1
- I cannot use this plugin on android. HOT 6
- The library doesn't work in Edit Mode HOT 1
- Play Asset Delivery use Asset Targeting by Country can't read asset in the master apk file. HOT 2
- Support for OpenHarmony 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 betterstreamingassets.