I’m currently working on a small project for myself (a multiplayer space shooter) and everything is working well in windows standalone build aswell as unity editor. I have a json file that I use to load settings at startup. So if I need to make a few changes in settings I only have to edit the json file instead of rebuilding everything.
How can I achieve the same for WebGL ? I already have a #if UNITY_WEBGL block but currently it’s hardcoded and if I want to change something I need to rebuild for WebGL (and it’s taking soooooo long it’s insane).
Anyhelp would help me a ton (and my processor too, he’s dying when I build to WebGL )
For standalone build I use relative path (aka. Application.dataPath + "/Config/myfile) and create a folder Config in MyApp/MyApp_data, but when building to WebGL Application.dataPath gives an url instead of the path to the app.
I would suggest to start by having your config file in Assets/StreamingAssets/Config, then download the file at run-time using UnityWebRequest. The url will be the following:
Application.streamingAssetsPath + "/Config/myfile
Have a look at this page for more info on the StreamingAssets directory.