We have this issue on our webserver/CMS where we want to deploy our PlayCanvas App - the JSON files are not handled by the webserver and thus PlayCanvas cannot load config.json and scenenumber.json files.
Changing the webserver policies is not an option right now, so I was thinking if could I feed the JSON data directly, but the loading system seems quite complex and intertwined with other parts of PC. Of course I started with the _start_.js where the first occurance of scene loading is handled (app.loadScene(SCENE_PATH, function (err, scene))
Any ideas how to feed the data from these two JSON files directly when loading the App?
Well the problem I encountered is that PC’s loading system needs and uses the URL in several parts of the code. The data themselves are not a problem.
What you mean is instead of using URL like "/playcanvas/config.json" use something like "data:application/json;base64,ew0KICAgICJtYWx0X3R5cGUiOiAibG9nIiwNCiAgICAibWFsdF9kYXRhIjogIldvdywgdSByIGFsbW9zdCB0aGVyZSA6TyINCn0=" which is the encoded JSON data instead?
Something like that. As I stated before, I am unable to load JSON files on the server the app will be running on (every other file type is fine). That means I need to load the data in those two JSON files some other way - preferably directly copying the JSON data from the file and using it as a variable inside the loading script.
Right now I am trying to tinker with the loading script inside playcanvas javascript library so that it will use this “hard coded” data directly for those 2 certain loadings (scene and config)
Just to confirm, you can’t serve JSON files. Can you load text files instead? I can’t remember if the engine cares about the extension for scenes and the config file.