Camera w/ Multiple Post Processing Effects Crashes on Re-Enabling

Hi @derek9nine,

I think that happened in a project of mine a few months ago, but I wasn’t sure if it was my implementation or an engine bug.

What I did back then after switching cameras, to avoid this exact error, was a hack like this:

// re-create post effects queue
    cameraEntity.camera.postEffects.destroy();
    try {
        cameraEntity.camera.postEffects = new pc.PostEffectQueue(this.app, cameraEntity);
    } catch (e) { }

// toggle on/off each effect to trigger the action that adds them to the effects queue
        cameraEntity.script.ssao.enabled = false;
        cameraEntity.script.ssao.enabled = true;

        cameraEntity.script.bloom.enabled = false;
        cameraEntity.script.bloom.enabled = true;

// etc
2 Likes