{"record":{"id":"e260a10d874fa1fe","repo":"BabylonJS/Babylon.js","slug":"the-computeshaderparticlesystem-class-is-not-avail","errorCode":null,"errorMessage":"The ComputeShaderParticleSystem class is not available! Make sure you have imported it.","messagePattern":"The ComputeShaderParticleSystem class is not available! Make sure you have imported it\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/Particles/gpuParticleSystem.pure.ts","lineNumber":1098,"sourceCode":"        isAnimationSheetEnabled: boolean = false\r\n    ) {\r\n        RegisterAnimatable();\r\n        super(name);\r\n\r\n        if (!sceneOrEngine || sceneOrEngine.getClassName() === \"Scene\") {\r\n            this._scene = (sceneOrEngine as Scene) || EngineStore.LastCreatedScene;\r\n            this._engine = this._scene.getEngine();\r\n            this.uniqueId = this._scene.getUniqueId();\r\n            this.layerMask = this._scene.defaultRenderableLayerMask;\r\n            this._scene.particleSystems.push(this);\r\n        } else {\r\n            this._engine = sceneOrEngine as AbstractEngine;\r\n            this.defaultProjectionMatrix = Matrix.PerspectiveFovLH(0.8, 1, 0.1, 100, this._engine.isNDCHalfZRange);\r\n        }\r\n\r\n        if (this._engine.getCaps().supportComputeShaders) {\r\n            if (!GetClass(\"BABYLON.ComputeShaderParticleSystem\")) {\r\n                throw new Error(\"The ComputeShaderParticleSystem class is not available! Make sure you have imported it.\");\r\n            }\r\n            this._platform = new (GetClass(\"BABYLON.ComputeShaderParticleSystem\"))(this, this._engine);\r\n        } else {\r\n            if (!GetClass(\"BABYLON.WebGL2ParticleSystem\")) {\r\n                throw new Error(\"The WebGL2ParticleSystem class is not available! Make sure you have imported it.\");\r\n            }\r\n            this._platform = new (GetClass(\"BABYLON.WebGL2ParticleSystem\"))(this, this._engine);\r\n        }\r\n\r\n        this._customWrappers = { 0: new DrawWrapper(this._engine) };\r\n        this._customWrappers[0]!.effect = customEffect;\r\n\r\n        this._drawWrappers = { 0: new DrawWrapper(this._engine) };\r\n        if (this._drawWrappers[0].drawContext) {\r\n            this._drawWrappers[0].drawContext.useInstancing = true;\r\n        }\r\n\r\n        this._createIndexBuffer();\r","sourceCodeStart":1080,"sourceCodeEnd":1116,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/Particles/gpuParticleSystem.pure.ts#L1080-L1116","documentation":"GPUParticleSystem selects its compute-shader backend platform by looking up the registered class \"BABYLON.ComputeShaderParticleSystem\" via the class registry. On engines supporting compute shaders, that class must be registered — it lives in a separate ES6 module import. If only the core/pure build is loaded without the side-effect module that registers the class, GetClass returns undefined and the system throws.","triggerScenarios":"Constructing new GPUParticleSystem(...) on an engine whose caps.supportComputeShaders is true (WebGPU or compute-capable backend) while the module registering ComputeShaderParticleSystem was never imported.","commonSituations":"Tree-shaken or side-effect-free ES6 imports (importing only gpuParticleSystem without the compute-shader platform module), switching a project from WebGL to WebGPU where the WebGPU-specific side-effect import is missing, or using pure/core builds instead of the full ES6 index.","solutions":["Import the full ES6 bundle or add the side-effect import that registers ComputeShaderParticleSystem (e.g. import from the package index or the computeShaderParticleSystem module).","Force the WebGL2 path by using an engine without compute shader support if the compute path is not desired.","Verify the imported build flavor: UMD/legacy builds include registration; cherry-picked pure modules do not."],"exampleFix":"// before\nimport { GPUParticleSystem } from \"@babylonjs/core/Particles/gpuParticleSystem\";\n// after: also import side-effect module that registers the class\nimport \"@babylonjs/core/Particles/computeShaderParticleSystem\";\n// or simply\nimport { GPUParticleSystem } from \"@babylonjs/core\";","handlingStrategy":"validation","validationCode":"if (engine.getCaps().supportComputeShaders) {\n  import(\"@babylonjs/core/Particles/computeShaderParticleSystem\"); // ensure registered\n}","typeGuard":null,"tryCatchPattern":"try {\n  const ps = new GPUParticleSystem(\"p\", { capacity: 1000 }, engine);\n} catch (e) {\n  if (e.message.includes(\"ComputeShaderParticleSystem\")) {\n    console.error(\"Missing side-effect import for WebGPU GPU particles\");\n  }\n}","preventionTips":["Import GPU particle classes from the full \"@babylonjs/core\" index in ES6 projects.","Remember side-effect imports are required when using deep module paths.","Check bundler isn't stripping side-effect imports."],"tags":["gpu-particles","webgpu","missing-import","side-effect-module"],"backgroundTag":"class-not-registered-missing-import","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}