{"record":{"id":"4f393a66147abd3c","repo":"pixijs/pixijs","slug":"particlecontainer-setchildindex-is-not-available","errorCode":null,"errorMessage":"ParticleContainer.setChildIndex() is not available. Please use ParticleContainer.setParticleIndex()","messagePattern":"ParticleContainer\\.setChildIndex\\(\\) is not available\\. Please use ParticleContainer\\.setParticleIndex\\(\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/scene/particle-container/shared/ParticleContainer.ts","lineNumber":668,"sourceCode":"     */\n    public override getChildAt<U extends ContainerChild>(_index: number): U\n    {\n        throw new Error(\n            'ParticleContainer.getChildAt() is not available. Please use ParticleContainer.getParticleAt()',\n        );\n    }\n    /**\n     * This method is not available in ParticleContainer.\n     *\n     * Calling this method will throw an error. Please use `ParticleContainer.setParticleIndex()` instead.\n     * @param {ContainerChild} _child\n     * @param {number} _index\n     * @throws {Error} Always throws an error as this method is not available.\n     * @ignore\n     */\n    public override setChildIndex(_child: ContainerChild, _index: number): void\n    {\n        throw new Error(\n            'ParticleContainer.setChildIndex() is not available. Please use ParticleContainer.setParticleIndex()',\n        );\n    }\n    /**\n     * This method is not available in ParticleContainer.\n     *\n     * Calling this method will throw an error. Please use `ParticleContainer.getParticleIndex()` instead.\n     * @param {ContainerChild} _child\n     * @throws {Error} Always throws an error as this method is not available.\n     * @ignore\n     */\n    public override getChildIndex(_child: ContainerChild): number\n    {\n        throw new Error(\n            'ParticleContainer.getChildIndex() is not available. Please use ParticleContainer.getParticleIndex()',\n        );\n    }\n    /**","sourceCodeStart":650,"sourceCodeEnd":686,"githubUrl":"https://github.com/pixijs/pixijs/blob/4b141e3ced7255b39c2114b6bca03421a37b2363/src/scene/particle-container/shared/ParticleContainer.ts#L650-L686","documentation":"ParticleContainer.setChildIndex is overridden to throw; reorder operations must use setParticleIndex so the particle buffer ordering stays correct. The generic index setter is blocked to avoid a silent no-op that desyncs render order from storage.","triggerScenarios":"Calling particleContainer.setChildIndex(child, newIndex) directly, or generic sort/reorder utilities that reorder children by index.","commonSituations":"Sorting particles (e.g., back-to-front); porting z-order code from a Container; generic drag-to-reorder UI operating on containers.","solutions":["Use particleContainer.setParticleIndex(child, newIndex) as the message directs.","If you only need draw order, check whether the particle container exposes a z/depth-based sort instead.","Make sort helpers container-type aware."],"exampleFix":"// before\nparticleContainer.setChildIndex(p, 0);\n\n// after\nparticleContainer.setParticleIndex(p, 0);","handlingStrategy":"type-guard","validationCode":"if (container instanceof ParticleContainer) {\n  throw new TypeError('Use ParticleContainer.setParticleIndex() instead of setChildIndex()');\n}","typeGuard":"import { Container, ParticleContainer } from 'pixi.js';\n\nfunction isParticleContainer(c: Container): c is ParticleContainer {\n  return c instanceof ParticleContainer;\n}","tryCatchPattern":null,"preventionTips":["Reorder particles with setParticleIndex.","Make sort/reorder helpers container-type aware.","Consider z/depth sorting where supported."],"tags":["particle-container","pixijs","container","api-misuse"],"backgroundTag":null,"analyzedSha":"4b141e3ced7255b39c2114b6bca03421a37b2363","analyzedAt":"2026-08-12T17:27:29.507Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}