Mobile browsers problem

I have a project that plays well on desktop browsers and doesn`t work on mobile browsers.
Preloader works but after the preloader reaches 100% I have a dead screen.

Do you know which PlayCanvas features may cause that?

What device is this on?

Do you get any errors in the browser devtools console?

What do you mean by dead screen?

1 Like

I`ve solved it. It was on Redmi Note 11. It was because of caching. When I reloaded the page over Incognito mode in Chrome web browser on mobile then all is ok.

Is there any built-in way to set no-cache during development mode? Or standard html meta tag ways to prevent caching?

What do you mean by development mode?

I meant that during development I upload it to my FTP often and I thought that if there is any button to export it with no cache. This is a question only because I can add those meta tags in html.

By default the assets are already cache busting except for game scripts for some reason. See Why is getFileUrl not adding hashes for script assets? · Issue #5136 · playcanvas/engine · GitHub

1 Like
(function() {
    pc.Asset.prototype.getFileUrl = function () {
        const file = this.file;

        if (!file || !file.url)
            return null;

        let url = file.url;

        if (this.registry && this.registry.prefix && !pc.ABSOLUTE_URL.test(url))
            url = this.registry.prefix + url;

        // add file hash to avoid hard-caching problems
        if (file.hash) {
            const separator = url.indexOf('?') !== -1 ? '&' : '?';
            url += separator + 't=' + file.hash;
        }

        return url;
    };
})();

Will adding that script code on the blind to my project solve caching problems during uploading new versions to the server? I’m asking cause I`m not sure If I understood you well.

You need to add that file to the project and change the loading parameter to be ‘after engine’

It should fix the caching issue with game scripts if thats the problem you are running into. As far as I know, there aren’t any side effects but you will have to do testing yourself to check.

1 Like

Thank you very much.