PlayCanvas freezes after launching the game

Hello, i have problem started 2 days ago now almost every second time i launch the game, it’s just black screen. The console says nothing and it freezes the PlayCanvas Editor, script editor and it has to be close all tabs with PlayCanvas and open PlayCanvas again in new tab … I’m using Google Chrome but as well I try on Edge and same problem happened there too. I try to delete cookies or go to incognito mode the problem still persists.

Hi @Lukas and welcome,

This may be related:

To cut a long story short, the issue was a Chrome bug that was resolved in a newer version. Try updating your Chrome browser to the latest version, and see if that resolves your issue.

Unfortunatelly it doesnt work i deleted and reimport ammo then lunch the game and black screen with freeze happened again. I also have updated Chrome to the latest “Chrome is up to date
Version 95.0.4638.54 (Official Build) (64-bit)” and as i mention i test it on Microsoft Edge too and it happened there as well.

1 Like

It may not be related then. @yaustar any ideas?

Not without being able to repro it unfortunately.

Can you share the project or a publish link for people to look at please?

At another guess, are you using a collision mesh? If so, how many of these and how many polys is each mesh?

1 Like

Unfortunatelly i cant share project Public , but i can add you to a project as u are PlayCanvas Team if u want … and to the another question im using collision and just in 4 objects and they use for now primitives object from PC all of them are Spheres and use Sphere Collisions as well. But i were using them a while and there was no problem before.

Add yaustar to the project and I will try to have a look at it over the next week or two when I have more time.

In the meantime. If its reproducible, I would make a fork of the project and start deleting stuff from it until its stable and narrow down what is causing the issue.

Eg delete half the scene, does it become stable. If no delete half the scene again. If yes, restore and delete the other half of the scene and see if it becomes stable.

Repeat the process until you isolate the issue.

I have some free this week now if you would like to add me to the project @Lukas ?

i added u to the project , i dont know what cause this i try steps from you but its matter of random when its freeze dont know what cause it

Had a quick look and you have an infinite loop in your code.

I did a private fork to check:

// initialize code called once per entity
Pulse.prototype.initialize = function() {
    this.factor = 0;
    , this.onMouseDown, this);
    while(this.ChangeColour === "1")
        const randomElement = colors[Math.floor(Math.random() * colors.length)];

        if(!usedColors.includes(randomElement)&& randomElement != this.entity.children[2].name){
            this.ChangeColour = randomElement;
            this.MaterialColour = this.ChangeColour;

            var meshInstance = this.entity.model.meshInstances;
            for (var i = 0; i < meshInstance.length; i++){

                var asset =,"material");
                this.entity.model.meshInstances[i].material = asset.resource;
        console.log('loop'); // I added this line to check

On startup it is possible for this.ChangeColour to always be "1" and does an infinite loop (I’ve added console.log in the loop to check)

As it’s based off a random number call, it only happens sometimes.

You will need to change the code so that it’s not possible for an infinite loop to occur.

1 Like

Thank you for quick response i didnt know that it was infinite as, it should run only untill fill all entities which have that script ,with name of colour instead of “1”