Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGL? #30

Open
Kulitorum opened this issue Jan 10, 2022 · 5 comments
Open

WebGL? #30

Kulitorum opened this issue Jan 10, 2022 · 5 comments

Comments

@Kulitorum
Copy link

This does not work in webgl for me.

FileNotFoundException: File not found at BetterStreamingAssets.ThrowFileNotFound (System.String path) [0x00000] in <00000000000000000000000000000000>:0

Was it supposed to work in webgl?

Also - can you help me with a specific project?

@gwiazdorrr
Copy link
Owner

WebGL support is not really feasible; Streaming Assets would need to be downloaded first. Plus there's no way to "discover" available Streaming Assets, so a build-time step to collect all the Streaming Assets would have to be added. More trouble than it is worth in my opinion.

@gwiazdorrr
Copy link
Owner

Keeping this open in case someone finds a better way.

@gwiazdorrr gwiazdorrr reopened this Jan 10, 2022
@xucian
Copy link

xucian commented Nov 10, 2022

I have an async solution for it. Nothing too fancy, but it does the job for me. I'm trying to keep everything async, so that's no issue for me.

I attached 2 files: one for collecting the StreamingAssets folder hierarchy before build and the other being a primordial async wrapper over the BSA library.

I'm sure this will be useful for someone, but maybe you can even integrate this into your lib.

After that, you have to call this in your build script for WebGL (before building):

        void CollectAndWriteStreamingAssetsDescriptor()
        {
            var saDesc = new StreamingAssetsDescriptor();
            saDesc.Collect();
            saDesc.WriteToStreamingAssets();
        }

And if you want to clean after the build:

        void DeleteStreamingAssetsDescriptor()
        {
            var path = StreamingAssetsDescriptor.GetMyPathInStreamingAssets();
            File.Delete(path);

            path += ".meta";
            if (File.Exists(path))
                File.Delete(path);
        }

streamingassets-webgl.zip

@gwiazdorrr
Copy link
Owner

Thanks, I like this approach a lot. Perhaps async BSA should be a thing.

@davidtsaksomo
Copy link

Hi, a suggestion, better to put somewhere in docs/description that webgl not supported, it would save people time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants