BabylonJS/Babylon.js · error

Method not implemented.

Error message

Method not implemented.

What it means

ThinParticleSystem.serialize() is an intentionally unimplemented stub. The thin (pure) particle system base is a rendering/kernel core not meant to be serialized directly; full serialization support lives in concrete subclasses like ParticleSystem. Calling serialize on a bare ThinParticleSystem always throws.

Source

Thrown at packages/dev/core/src/Particles/thinParticleSystem.pure.ts:777

                        index--;
                    }
                    continue;
                }
            }
        };
    }

    /** @internal */
    public _emitFromParticle: (particle: Particle) => void = (_particle) => {
        // Do nothing
    };

    /**
     * Serializes the particle system to a JSON object.
     * @param _serializeTexture Whether to serialize the texture information
     */
    serialize(_serializeTexture: boolean) {
        throw new Error("Method not implemented.");
    }

    /**
     * Clones the particle system.
     * @param name The name of the cloned object
     * @param newEmitter The new emitter to use
     * @param _cloneTexture Also clone the textures if true
     */
    public clone(name: string, newEmitter: any, _cloneTexture = false): ThinParticleSystem {
        throw new Error("Method not implemented.");
    }

    private _syncLifeTimeCreation() {
        if (this.targetStopDuration && this._lifeTimeGradients && this._lifeTimeGradients.length > 0) {
            this._lifeTimeCreation.process = _CreateLifeGradientsData;
            return;
        }

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Use ParticleSystem (or a subclass that implements serialize) instead of ThinParticleSystem directly.
  2. Override serialize in your own subclass if you need custom serialization.
  3. Guard: skip serialization when the instance is exactly ThinParticleSystem (check constructor/prototype).

Example fix

// before
const ps = new ThinParticleSystem("p", 100, scene);
const json = ps.serialize(true);
// after
const ps = new ParticleSystem("p", 100, scene);
const json = ps.serialize(true);
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(ps instanceof ParticleSystem)) throw new Error("Serialization requires a ParticleSystem subclass");

Type guard

function isSerializable(ps: ThinParticleSystem): ps is ParticleSystem {
  return typeof ps.serialize === "function" &&
    Object.getPrototypeOf(ps).constructor !== ThinParticleSystem;
}

Try / catch

try {
  const json = ps.serialize(true);
} catch (e) {
  if (e.message === "Method not implemented.") {
    console.warn("ThinParticleSystem cannot be serialized; use ParticleSystem");
  }
}

Prevention

When it happens

Trigger: Calling thinParticleSystem.serialize(true|false) on an instance typed as ThinParticleSystem (not a ParticleSystem subclass) — e.g. via SceneSerializer walking components, or custom code holding a ThinParticleSystem reference.

Common situations: Saving a scene that contains a raw ThinParticleSystem; using ThinParticleSystem directly instead of ParticleSystem; custom frameworks that treat all particle systems uniformly with serialize().

Related errors


AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30). Data as JSON: /api/errors/91377c441caf8f41. Report an issue: GitHub.