Error: scene.enableFluidRenderer is not a function

Hello again everybody! :slight_smile:


scene.enableFluidRenderer is not a function

After calling enableFluidRenderer() function of my scene the error above is displaying.

I use tree-shaking so I must use complete imports.

Example of my imports:

import { Texture } from "@babylonjs/core/Materials/Textures/texture";
import { Color4 } from "@babylonjs/core/Maths/math.color";
import { Vector3 } from "@babylonjs/core/Maths/math.vector";
import { GPUParticleSystem, ParticleSystem } from "@babylonjs/core/Particles";
import { Scene } from "@babylonjs/core/scene";

import type {
} from "@babylonjs/core/Rendering/fluidRenderer/fluidRenderer";

Bad fix of my trouble

If I use basic import at least once - the whole application is working and renders fluids, no more errors are seen.

Basic import example with which the app is working is below:

import { anyClassIDoWant } from "@babylonjs/core"

Project settings

Below are some settings of my project.
My package.json file (no side-effects here, already faced it xD)
  "name": "1.0.0",
  "version": "1.0.0",
  "type": "module",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "webpack serve --hot --config",
    "prebuild": "webpack serve --hot --config",
    "build": "webpack build --config"
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "css-loader": "^6.7.4",
    "html-webpack-plugin": "^5.5.1",
    "sass": "^1.62.1",
    "sass-loader": "^13.3.0",
    "style-loader": "^3.3.3",
    "terser-webpack-plugin": "^5.3.9",
    "ts-loader": "^9.4.2",
    "typescript": "^5.0.4",
    "webpack": "^5.83.1",
    "webpack-bundle-analyzer": "^4.8.0",
    "webpack-cli": "^5.1.1",
    "webpack-dev-server": "^4.15.0",
    "webpack-merge": "^5.9.0"
  "dependencies": {
    "@babylonjs/core": "^6.4.1",
    "@babylonjs/inspector": "^6.4.1",
    "@babylonjs/loaders": "^6.4.1"
My tsconfig.json file
  "compilerOptions": {
      "module": "ES2022",
      "target": "ES2017",
      "moduleResolution": "node",

Looking forward for some help, thank you.

Try adding import "@babylonjs/core/Rendering/fluidRenderer/fluidRenderer"; for the side effects.

1 Like

Thank you for advice. I did as you told but it doesn’t help, still got error.

Another funny fact. If Inspector is imported (as import "@babylonjs/inspector";) somewhere in the app - fluids are working again.

cc @RaananW, as my knowledge on how those things work is a bit limited!

As @Evgeni_Popov you need to import for side effects whereas in your case you import types only. So mport "@babylonjs/core/Rendering/fluidRenderer/fluidRenderer"; should definitely work or at least provide a different error ?

1 Like

I don’t know where I was mistaken before but now it worked (I really believe I did the same stuff, but we all know it’s impossible). I am sorry @Evgeni_Popov :slight_smile: and thanks again.
Previous error disappeared but I got a bunch of new ones but only in console. Scene was loaded, but fluids are not rendered.

The console errors:

Lol, I really did the same stuff before…


You would need an extra import "@babylonjs/core/Engines/Extensions/engine.transformFeedback";

@Evgeni_Popov I guess this should be in the fluidrenderer to prevent extra manual setup

1 Like

Oh my gosh, that worked. Thank you very much!

1 Like

Will be fixed in Fix FluidRenderer required side effects. by sebavan · Pull Request #13948 · BabylonJS/Babylon.js · GitHub