{"record":{"id":"1b1bfa72799183df","repo":"BabylonJS/Babylon.js","slug":"there-is-no-tilecache-generated","errorCode":null,"errorMessage":"There is no TileCache generated.","messagePattern":"There is no TileCache generated\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/addons/src/navigation/plugin/RecastNavigationJSPlugin.ts","lineNumber":526,"sourceCode":"     * @param tileCacheData the data returned by getTileCacheData\n     * @param tileCacheMeshProcess optional process to apply to each tile created\n     */\n    public buildFromTileCacheData(tileCacheData: Uint8Array, tileCacheMeshProcess?: TileCacheMeshProcess): void {\n        const result = this.bjsRECAST.importTileCache(tileCacheData, tileCacheMeshProcess ?? CreateDefaultTileCacheMeshProcess([]));\n        this.navMesh = result.navMesh;\n        this._tileCache = result.tileCache;\n        this._navMeshQuery = new this.bjsRECAST.NavMeshQuery(this.navMesh);\n    }\n\n    /**\n     * returns the tile cache data that can be used later. The tile cache must be built before retrieving the data\n     * @returns the tile cache data that can be used later. The tile cache must be built before retrieving the data\n     * @throws Error if there is no TileCache generated\n     * @remarks The returned data can be used to rebuild the tile cache later using buildFromTileCacheData\n     */\n    public getTileCacheData(): Uint8Array {\n        if (!this.navMesh || !this._tileCache) {\n            throw new Error(\"There is no TileCache generated.\");\n        }\n        return this.bjsRECAST.exportTileCache(this.navMesh, this._tileCache);\n    }\n\n    /**\n     * Disposes\n     */\n    public dispose() {\n        this._crowd?.dispose();\n        this.navMesh?.destroy();\n        this._navMeshQuery?.destroy();\n        this._tileCache?.destroy();\n    }\n\n    /**\n     * Creates a cylinder obstacle and add it to the navigation\n     * @param position world position\n     * @param radius cylinder radius","sourceCodeStart":508,"sourceCodeEnd":544,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/addons/src/navigation/plugin/RecastNavigationJSPlugin.ts#L508-L544","documentation":"getTileCacheData() exports the tile cache built with buildTileCache so it can be saved and later restored via buildFromTileCacheData. It requires both a navmesh (this.navMesh) and a tile cache (this._tileCache) to exist; otherwise it throws this error.","triggerScenarios":"Calling getTileCacheData() when buildTileCache was never called, when tile-based navmesh creation was not requested (no tileCache produced), or when the navMesh itself is null (never created or disposed).","commonSituations":"Saving tile cache data in a non-tiled navmesh workflow; calling the export before the navmesh build completes; exporting after dispose(); mixing tileCache APIs with a navmesh built without tile caching.","solutions":["Build a tiled navmesh and call buildTileCache before exporting","Verify this.navMesh exists before calling getTileCacheData","Await navmesh/tile cache creation before exporting","Use getNavmeshData instead if the workflow is non-tiled"],"exampleFix":"// before\nconst tileCacheData = plugin.getTileCacheData();\n// after\nif (plugin.navMesh && plugin._tileCache) {\n    const tileCacheData = plugin.getTileCacheData();\n} else {\n    await plugin.createNavMeshAsync(meshes, tileParameters);\n}","handlingStrategy":"validation","validationCode":"if (!plugin.navMesh || !(plugin as any)._tileCache) {\n    throw new Error(\"Tiled navmesh and tile cache required before export\");\n}\nconst data = plugin.getTileCacheData();","typeGuard":"const hasTileCache = (p: { navMesh?: unknown; _tileCache?: unknown }): boolean => p.navMesh != null && p._tileCache != null;","tryCatchPattern":"try {\n    const data = plugin.getTileCacheData();\n} catch (e) {\n    if (e.message.includes(\"no TileCache\")) {\n        // fall back to non-tiled export or rebuild tiled navmesh\n        const data = plugin.getNavmeshData();\n    }\n}","preventionTips":["Use tile-cache APIs only with tiled navmesh builds","Await the full build pipeline (createNavMesh + buildTileCache) before exporting","Keep navmesh and tile cache lifecycle (create/dispose) in one module"],"tags":["navigation","recast","tilecache","lifecycle"],"backgroundTag":"navmesh-not-built","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}