Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(tilemap): invisible-but-solid maps fail LOUD - P0 of the dogfood cluster

yhh57ced2cd895f
diff --git a/sdk/src/asset/loaders/TilemapAssetLoader.ts b/sdk/src/asset/loaders/TilemapAssetLoader.ts
index 3094d6a56..33aaf753b 100644
--- a/sdk/src/asset/loaders/TilemapAssetLoader.ts
+++ b/sdk/src/asset/loaders/TilemapAssetLoader.ts
@@ -45,7 +45,15 @@ export class TilemapAssetLoader implements AssetLoader<TilemapResult> {
const result = await ctx.loadTexture(imagePath, true);
textureHandle = result.handle;
} catch (e) {
- log.warn('asset', `Failed to load tileset texture: ${imagePath}`, e);
+ // Loud, with the fix: a dead tileset texture makes every tile that
+ // uses it invisible (the renderer drops handle-0 slots), while the
+ // map's collision still generates — an invisible-but-solid level is
+ // the single most confusing failure this loader can produce.
+ log.error('tilemap',
+ `"${path}": tileset "${ts.name}" image failed to load `
+ + `("${ts.image}" → "${imagePath}") — its tiles will NOT render `
+ + '(collision still generates). Check that the image exists at that '
+ + 'path and is imported into the project.', e);
}
const rows = ts.columns > 0 ? Math.max(1, Math.ceil(ts.tileCount / ts.columns)) : 1;
tilesets.push({ textureHandle, columns: ts.columns, rows, firstId: ts.firstGid });
diff --git a/sdk/src/tilemap/tilemapPlugin.ts b/sdk/src/tilemap/tilemapPlugin.ts
index 9c61a75cc..871ca8b15 100644
--- a/sdk/src/tilemap/tilemapPlugin.ts
+++ b/sdk/src/tilemap/tilemapPlugin.ts
@@ -369,6 +369,15 @@ export class TilemapPlugin implements Plugin {
.map(t => ({ firstId: t.firstId, textureHandle: t.textureHandle, columns: t.columns }));
if (slots.length > 0) {
TilemapAPI.setTilesets(child, slots);
+ } else if (cached.tilesets.length > 0) {
+ // Every tileset texture is dead (handle 0): the map parsed
+ // and its collision generates, but nothing will draw. Say
+ // so ONCE, loudly — silently-invisible-but-solid levels
+ // cost a real debugging session to diagnose from pixels.
+ log.error('tilemap',
+ `Tiled map on entity ${entity}: none of its ${cached.tilesets.length} `
+ + 'tileset texture(s) loaded — tiles will NOT render (collision still '
+ + 'works). See earlier [tilemap] load errors for the failing image path(s).');
}
children.push(child);