Render target of mesh with onBeforeRender

this.profileMesh.onBeforeRender = (renderer) => {
            renderer.setRenderTarget(this.rt2);
            renderer.render(this.rtScene2, this.camera);
            renderer.setRenderTarget(null);
        }



        this.sceneBG.add(this.profileMesh);

On the render i have

this.renderer.setRenderTarget( this.renderTargetImage);
            this.renderer.render(this.sceneBG,this.camera);
            this.finalMAT.uniforms["uImage"].value = this.renderTargetImage.texture;

The uImage render nothing instead of if i put in a mesh without onBeforeRender works correctly.

Any idea why? Thank you

Solved by moving on before render code directly in the render function and render to target there. I don’t know if there is a logic behind or if is a bug.