How to use the ProjectSettings.load_resource_pack()

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Isccb

As the .pck file gets very big when I export my project to HTLM5 and takes a long time to load when integrated into a website, I decided to export several .pck files dividing the scenes, instead of exporting the entire game to a .pck file. So I published it on the website with an html file and several .pck.
I am trying to load the level2 .pck files for example, while executing level1 using “ProjectSettings.load_resource_pack (” res: //PCK/KitMission.pck “)”
to load the .pck at runtime, but it’s not working. When I run the game on a web page and reach level 2, which should have been loaded on level 1, it says that it was not possible to load the scene

load_resource_pack returns true on success. What does it return in your case? Also be aware that res:// in an exported project refers to the *.pck-file, i.e. you’re trying to load a package within the main package. If you want to separate them, use user:// instead (and place the *.pck-files in the appropriate location).

njamster | 2020-05-19 21:20

:bust_in_silhouette: Reply From: maddytroupe

Kindly save your pack to user folder like“user://pack1.pck”,File.write)
and then do the below

ProjectSettings.loadresourcepack (“user://pack1.pck”);
then you load your scenes based on godot virtual url. like below