{"record":{"id":"b93969cd4ebad619","repo":"BabylonJS/Babylon.js","slug":"gpu-particles-cannot-work-without-a-full-engine-t","errorCode":null,"errorMessage":"GPU particles cannot work without a full Engine. ThinEngine is not supported","messagePattern":"GPU particles cannot work without a full Engine\\. ThinEngine is not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/Particles/webgl2ParticleSystem.pure.ts","lineNumber":224,"sourceCode":"    }\r\n\r\n    /** @internal */\r\n    public bindDrawBuffers(index: number, effect: Effect, indexBuffer: Nullable<DataBuffer>): void {\r\n        if (indexBuffer) {\r\n            this._engine.bindBuffers(this._renderVertexBuffers, indexBuffer, effect);\r\n        } else {\r\n            this._engine.bindVertexArrayObject(this._renderVAO[index], null);\r\n        }\r\n    }\r\n\r\n    /** @internal */\r\n    public preUpdateParticleBuffer(): void {\r\n        const engine = this._engine as Engine;\r\n\r\n        this._engine.enableEffect(this._updateEffect);\r\n\r\n        if (!engine.setState) {\r\n            throw new Error(\"GPU particles cannot work without a full Engine. ThinEngine is not supported\");\r\n        }\r\n    }\r\n\r\n    /** @internal */\r\n    public updateParticleBuffer(index: number, targetBuffer: Buffer, currentActiveCount: number): void {\r\n        this._updateEffect.setTexture(\"randomSampler\", this._parent._randomTexture);\r\n        this._updateEffect.setTexture(\"randomSampler2\", this._parent._randomTexture2);\r\n\r\n        if (this._parent._flowMap) {\r\n            this._updateEffect.setTexture(\"flowMapSampler\", this._parent._flowMap);\r\n        }\r\n\r\n        if (this._parent._sizeGradientsTexture) {\r\n            this._updateEffect.setTexture(\"sizeGradientSampler\", this._parent._sizeGradientsTexture);\r\n        }\r\n\r\n        if (this._parent._angularSpeedGradientsTexture) {\r\n            this._updateEffect.setTexture(\"angularSpeedGradientSampler\", this._parent._angularSpeedGradientsTexture);\r","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/Particles/webgl2ParticleSystem.pure.ts#L206-L242","documentation":"The WebGL2 GPU particle update pipeline relies on engine capabilities that only the full Engine class provides (specifically setState used inside enableEffect/update flow). preUpdateParticleBuffer casts this._engine to Engine and verifies engine.setState exists; if the system was created against a ThinEngine (or another engine lacking setState), it cannot run the GPU update pass and throws.","triggerScenarios":"GPUParticleSystem created with a ThinEngine (or engine without a setState method) then running its update loop: preUpdateParticleBuffer() checks !engine.setState and throws.","commonSituations":"Using GPUParticleSystem with ThinEngine/NullEngine (e.g. headless tests, minimal custom engines) where only ThinEngine is available; constructing the platform class manually against a thin engine.","solutions":["Create GPUParticleSystem with a full Engine (new Engine(canvas, ...)), not ThinEngine.","Use the CPU ParticleSystem when only a ThinEngine is available.","Feature-check engine.setState before wiring GPU particles and fall back to CPU particles."],"exampleFix":"// before\nconst engine = new ThinEngine(canvas);\nconst ps = new GPUParticleSystem(\"p\", { capacity: 1000 }, engine);\n// after\nconst engine = new Engine(canvas, true);\nconst ps = new GPUParticleSystem(\"p\", { capacity: 1000 }, engine);","handlingStrategy":"validation","validationCode":"if (!(\"setState\" in engine)) {\n  throw new Error(\"GPUParticleSystem requires a full Engine, not ThinEngine\");\n}","typeGuard":"function supportsGpuParticles(engine: AbstractEngine): engine is Engine {\n  return typeof (engine as Engine).setState === \"function\";\n}","tryCatchPattern":null,"preventionTips":["Use full Engine for GPU particles; reserve ThinEngine for CPU ParticleSystem.","Feature-check engine.setState before choosing GPU vs CPU particles.","Avoid NullEngine/ThinEngine in production particle paths."],"tags":["gpu-particles","engine-capability","webgl2"],"backgroundTag":"engine-capability-unsupported","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}