Giter Site home page Giter Site logo

Comments (5)

gwiazdorrr avatar gwiazdorrr commented on July 27, 2024

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.

JakobDutch avatar JakobDutch commented on July 27, 2024

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.

gwiazdorrr avatar gwiazdorrr commented on July 27, 2024

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.

JakobDutch avatar JakobDutch commented on July 27, 2024

@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.

gwiazdorrr avatar gwiazdorrr commented on July 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.