BabylonJS/Babylon.js · error · Error
There is no TileCache generated.
Error message
There is no TileCache generated.
What it means
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.
Source
Thrown at packages/dev/addons/src/navigation/plugin/RecastNavigationJSPlugin.ts:526
* @param tileCacheData the data returned by getTileCacheData
* @param tileCacheMeshProcess optional process to apply to each tile created
*/
public buildFromTileCacheData(tileCacheData: Uint8Array, tileCacheMeshProcess?: TileCacheMeshProcess): void {
const result = this.bjsRECAST.importTileCache(tileCacheData, tileCacheMeshProcess ?? CreateDefaultTileCacheMeshProcess([]));
this.navMesh = result.navMesh;
this._tileCache = result.tileCache;
this._navMeshQuery = new this.bjsRECAST.NavMeshQuery(this.navMesh);
}
/**
* returns the tile cache data that can be used later. The tile cache must be built before retrieving the data
* @returns the tile cache data that can be used later. The tile cache must be built before retrieving the data
* @throws Error if there is no TileCache generated
* @remarks The returned data can be used to rebuild the tile cache later using buildFromTileCacheData
*/
public getTileCacheData(): Uint8Array {
if (!this.navMesh || !this._tileCache) {
throw new Error("There is no TileCache generated.");
}
return this.bjsRECAST.exportTileCache(this.navMesh, this._tileCache);
}
/**
* Disposes
*/
public dispose() {
this._crowd?.dispose();
this.navMesh?.destroy();
this._navMeshQuery?.destroy();
this._tileCache?.destroy();
}
/**
* Creates a cylinder obstacle and add it to the navigation
* @param position world position
* @param radius cylinder radiusView on GitHub (pinned to 0592b347b8)
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
Example fix
// before
const tileCacheData = plugin.getTileCacheData();
// after
if (plugin.navMesh && plugin._tileCache) {
const tileCacheData = plugin.getTileCacheData();
} else {
await plugin.createNavMeshAsync(meshes, tileParameters);
} Defensive patterns
Strategy: validation
Validate before calling
if (!plugin.navMesh || !(plugin as any)._tileCache) {
throw new Error("Tiled navmesh and tile cache required before export");
}
const data = plugin.getTileCacheData(); Type guard
const hasTileCache = (p: { navMesh?: unknown; _tileCache?: unknown }): boolean => p.navMesh != null && p._tileCache != null; Try / catch
try {
const data = plugin.getTileCacheData();
} catch (e) {
if (e.message.includes("no TileCache")) {
// fall back to non-tiled export or rebuild tiled navmesh
const data = plugin.getNavmeshData();
}
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Unable to deserialize TileCache.
- There is no NavMesh generated.
- Recast is not initialized. Please call InitRecast first.
- Unable to deserialize NavMesh.
- At least one mesh is needed to create the nav mesh.
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/1b1bfa72799183df.
Report an issue: GitHub.