Error when importing GlowLayer into project

I am having some issues importing GlowLayer into my project. Everything works fine on a playground subdivision of my code. It glows as intended. However, when I try importing the GlowLayer into my entire project (offline, not playground), I get the following error:

effectLayer.js?b602:215 Uncaught TypeError: this._scene.getBoundingBoxRenderer is not a function
at GlowLayer.EffectLayer._createMainTexture (effectLayer.js?b602:215)
at GlowLayer.EffectLayer._init (effectLayer.js?b602:122)
at new GlowLayer (glowLayer.js?33c1:50)

I am importing GlowLayer and using it like this:

import {GlowLayer} from “@babylonjs/core/Layers”;
var glow = new GlowLayer(“glow”, scene);

Anyone have any idea what I am missing here?

make sure to add:

import "@babylonjs/core/Rendering/boundingBoxRenderer";

to get the function assigned correctly.

1 Like

Weird it should not be mandatory to import by default

Are you using our latest preview ?

1 Like

Thanks, RaananW, that fixed it.

Sebavan, I am using Babylon version 4.2.

Makes sense as the fix to not require it is only in 5.0 preview.