The mesh disappears in Aggressive mode when has disabled instances

Hey! Could you please explain why sphere mesh disappears in Aggressive mode? It woks OK in Intermediate mode(AFAIK because in the aggressive mode each mesh was frozen - https://github.com/BabylonJS/Babylon.js/blob/658d1b639addf05ade533e7b0f88059e6be89810/packages/dev/core/src/Meshes/mesh.ts#L2396).

The mesh has an instance which disabled(it doesn’t matter how much).

If you uncomment the last line with timeout it appears again.

Instead of timeout you can use runCoroutineAsync

    scene.onAfterRenderObservable.runCoroutineAsync((function*(){
        let skipFrames = 20;
        while(skipFrames > 0){
            skipFrames--;
            yield;
        }
        
        //uncomment to fix the issue
        sphere._unFreeze();
    })());

In the documentation I see that we set isVisible=false for the root mesh. But is it necessary? Why does it work after timeout?

Seems like engine.getCaps().parallelShaderCompile = null; in the start of function solve the problem. But I’m looking for a better fix.

@Evgeni_Popov Could you help me pls?

Because you’re in Aggressive mode, the mesh and material are frozen, which leads to some inconsistencies when you add to this the fact that the single instance that is created is immediately deactivated: some codes consider that the mesh has instances (because the mesh actually has an instance) and others that it doesn’t (because even if the mesh has an instance, it’s deactivated).

To solve this problem in your PG, you can use the scene.executeWhenReady method before returning the createScene method:

I’ve also added code that reactivates the instance after 2s, so you can see what to do in this case: you need to unfreeze the mesh so that the code notices the change and acts accordingly.

[EDIT] I forgot to say that the mesh will be automatically frozen again because of the Aggressive mode.