Custom initializing of the project

Hi.
Is there any way to load the project not immediately, after loading the page, but, for example, on a custom callback?
I mean the case if I want to integrate a playcanvas project into a other html-page, but start downloading the project (all assets and project files) after, for example, the corresponding button has been clicked.
As far as I understand, for this purpose it is necessary to change somehow project files in the build, however I cannot find where it is necessary to make it.

I will be very grateful for the answer.

Hi @Yurii,

You can download a build and inspect how the PlayCanvas loader works to accommodate it your needs. You will see in the __start__.js file at the end how it loads the modules and then fires the configure() method.

    if (PRELOAD_MODULES.length > 0) {
        loadModules(PRELOAD_MODULES, ASSET_PREFIX, configure);
    } else {
        configure();
    }

You can comment that out and attach it to a global method or event that listens to your app. So the PlayCanvas app will boot when it’s instructed to do so.

1 Like

thank you so much @Leonidas!
It works

1 Like