Is it possible to load scenes and resources from URLs?

Godot Version

Godot-Stable-4.5.1

Question

I know it’s possible to load images via URLs in Godot, but is it possible to load scenes and other resources using a similar method? I only ask because I’m trying to make a full 3d Godot game that runs in the browser, and it would be ideal if I could load assets as needed via http request (so that way the player doesn’t have to wait for a 100 MB web page to load.)

Logically, there should be no difference between obtaining an image and any other resource.

I had experimented with it briefly, with partial success. I placed a scene and its corresponding script file on my web server, and downloaded them with HTTPRequest to a user:// location. When trying to load the scene file, Godot issued errors about the file combination. The script consisted of a single print statement for simplicity.

I was busy, so I didn’t pursue the errors to resolution/definite failure, but dynamically downloading scenes is not the same as loading them from within the project’s res:// tree.

It’s starting to come back to me. The scene file has the full res:// path of the script embedded into it. When downloading the files into the user:// path, they are not in the path embedded into the scene file. Additionally, the id and the uid will likely be meaningless. I haven’t progressed far enough to test if the ui and uid will cause problems.

I have not tried the officially supported PCK export. I don’t remember why I thought it wouldn’t work for my purposes.

1 Like

I think what you’re looking for are patches, see here:

Thanks! This looks like it might be exactly what I need!