Giter Site home page Giter Site logo

Comments (6)

gwiazdorrr avatar gwiazdorrr commented on July 27, 2024 1

Finally remembered to look at this. Seems that loading from a jar using WWW/UnityWebRequest is hopeless in Editor. So instead of that, I just decided to handle errors better with 12d6df3. Thanks for noticing this!

from betterstreamingassets.

AdamDoesThingsSometimes avatar AdamDoesThingsSometimes commented on July 27, 2024

Also apologies for the multiple edits! I hit enter without expecting it to actually post just a title! :)

from betterstreamingassets.

AdamDoesThingsSometimes avatar AdamDoesThingsSometimes commented on July 27, 2024

Just realised I could test using iOS/PC mode, and it works perfectly - it may be that I'm misusing the tool truth be told.

I appear to have worked out where it's falling over through the use of breakpoints and debug.logs, as I never get to see past the first debug.log in this get method. :) I believe it's stumbling at the new Uri for a reason or another.

My test here is to make a uri and see what I can do with it.

Understandably, it hits the else condition myURiTest.TryCreate if I make the UriKind Absolute, as all it has to work with is cwlcommissioner.apk - without any further details or formatting.

It'll log the first line, but trying to get the AbsoluteUri throws the error:
System.InvalidOperationException: This operation is not supported for a relative URI.

        private string StreamingAssetsPath
        {
            get
            {
#if UNITY_EDITOR
                if (BetterStreamingAssets.Root == EditorApkPath)
                {
                    Debug.Log("Making new  uri");
                    Uri myUriTest;
                    if (Uri.TryCreate(EditorApkPath, UriKind.Relative, out myUriTest))
                    {
                        Debug.Log("Made myUriTest " + myUriTest); // We reach this one
                        Debug.Log("Here is its AbsoluteUri" + myUriTest.AbsoluteUri); //But fail on this
                    }
                    else
                    {
                        Debug.Log("Couldn't make a relativeOrAbsoluteUri from " + EditorApkPath);
                    }

                    return "jar:" + new Uri(EditorApkPath).AbsoluteUri + "!/assets";
                }
#endif
                return Application.streamingAssetsPath;
            }
        }

I think this may be useful :)
image

from betterstreamingassets.

AdamDoesThingsSometimes avatar AdamDoesThingsSometimes commented on July 27, 2024

As an aside, I commented out the testHarness call (and all the error catching) and made a really primitive version... and it works perfectly! :)

The code I edited:

                           if (BetterStreamingAssets.FileExists(path))
                            {
                                Debug.Log("YAY" + path + " exists!");
                                yield return null;
                            }
                            else
                            {
                                Debug.Log("Oh bother, we lost the file at " + path);
                            }

                            byte[] byties = BetterStreamingAssets.ReadAllBytes(path);

                            Debug.Log("Copying to " + Application.persistentDataPath);
                            File.WriteAllBytes(Application.persistentDataPath + "/arenasetup.txt", byties);

                            //yield return coroutineHost.StartCoroutine(ErrorCatchingCoroutine(TestHarness(readMode, path, testType, attempts,
                            //    (duration, bytes, memory, maxMemory, names) =>
                            //    {
                            //        testInfo.duration = duration;
                            //        testInfo.bytesRead = bytes;
                            //        testInfo.memoryPeak = memory;
                            //        testInfo.maxMemoryPeak = maxMemory;
                            //    }),
                            //    ex =>
                            //    {
                            //        Debug.Log(ex);
                            //        testInfo.error = ex;
                            //    }
                            //));

                            results.Add(testInfo);

I am overjoyed at your solution to so many problems, and can't wait to make android builds after so much of my own time trying to come up with a solution! :) Thank you so much again, I can't overstate how much time and pain you've saved me and many other developers! :) I'll leave a glowing review on the asset store, and am happy to chip in with any extra info if I can help with this issue. :)

from betterstreamingassets.

gwiazdorrr avatar gwiazdorrr commented on July 27, 2024

Thanks for the report, I'll need some time to process this and then I will get back to you!

from betterstreamingassets.

AdamDoesThingsSometimes avatar AdamDoesThingsSometimes commented on July 27, 2024

That's great! :) Thank you again, BetterStreamingAssets was a godsend for this project :)

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.