How to disabled auto load app

Hi, guys,

The Playcanvas will automatically load app by default, so
I want to disable.

I have to manually start load after the button(html element) clicked.
Therfore I modified function in loadingScreen.js but does not work.
The app always load on background.

   ...

    var createEventListener = function() {
        var btn = document.getElementsByClassName('btn--start')[0];
        btn.addEventListener('click', start);
        btn.addEventListener('touchend', start);
    };

    function start() {
        console.log('start');
 
        app.on('preload:start', function () {
            app.off('preload:progress');
        });
        
        app.on('preload:progress', setProgress);
        app.on('start', hideSplash);       

    }

    createCss();
    showSplash();
    createEventListener();

What I wrong?

Thank you.

Makoto TAMURA

There are couple of approaches to this. If you are happy in loading the engine and starting the app, you can use an initial scene that preloads very little and when the button is pressed, loads the assets and the actual scene.

Eg Loading Scenes | Learn PlayCanvas

Kapture 2022-05-26 at 13.37.45

If you don’t want to load PlayCanvas at all, you will have to change __start__.js file. You can’t do this on a playcanv.as hosted build. If you are self hosting, after you download the build, you can modify the __start__.js file that is in the build zip.

1 Like

Hi yaustar;

I found your approach to make a lot of sense.

I will try it!

Thank you for your help!