Hi folks... I am trying to upload text file into WebGL Unity on runtime. Building a Javascript library and using "Send Message" function helps but I have hit a rock on that road and nobody has a solution for it yet. So I am trying to upload file with Javascript to Indexeddb where unity (Application.persistentdatapath) can access natively but I couldn't find its database name. I have tried making Unity write to console where it uploads but it has a different access system so no luck. Can someone explain me where Unity (Application.persistentdatapath) uses to save persistent data in Indexeddb?
This method uses above mentioned "send message" function to send data to unity. Problem is when text file size goes around 2mb, WebGL goes out of memory, no matter how much RAM you allocate. You can try it out yourself here and it source codes are here. That is a common problem as much as my reseach tells me. That's why I am trying for Indexeddb approach.
Well, I found out what I did wrong. My method was reading contents of text file in Javascript with FileReader and sending a large string in "Send Message" function. The problem with that is there is a limit how long strings can be in browsers, therefore errors. "URL.createObjectURL" javascript method creates a blob and sends its location in string so it works. The reason that example is not working, because it tries to render contents of text file and if it is too large, it goes out of memory. I assumed Javascript "FileReader" and "URL.createObjectURL" worked same as each other.
Hi, I've made an asset for picking and downloading files on WebGL Simple File Browser for WebGL https://assetstore.unity.com/packages/tools/integration/simple-file-browser-for-webgl-234993