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: show empty placeholder instead of '0' for texture fields with non-string values

esengine190e45aaf286
diff --git a/editor/src/property/editors.ts b/editor/src/property/editors.ts
index 78e81f0cd..1e6587995 100644
--- a/editor/src/property/editors.ts
+++ b/editor/src/property/editors.ts
@@ -706,7 +706,7 @@ function createTextureEditor(
const input = document.createElement('input');
input.type = 'text';
input.className = 'es-input es-input-texture es-asset-link';
- input.value = String(value ?? '');
+ input.value = (value && typeof value === 'string') ? value : '';
input.placeholder = 'None';
input.readOnly = true;
@@ -762,7 +762,7 @@ function createTextureEditor(
}
};
- updatePreview(String(value ?? ''));
+ updatePreview((value && typeof value === 'string') ? value : '');
input.addEventListener('click', navigateToAssetPath);
preview.addEventListener('click', navigateToAssetPath);
diff --git a/editor/src/property/materialEditors.ts b/editor/src/property/materialEditors.ts
index 130b6327c..9548d72b4 100644
--- a/editor/src/property/materialEditors.ts
+++ b/editor/src/property/materialEditors.ts
@@ -227,7 +227,7 @@ function createMaterialTextureEditor(
const input = document.createElement('input');
input.type = 'text';
input.className = 'es-input es-input-texture es-asset-link';
- input.value = String(value ?? '');
+ input.value = (value && typeof value === 'string') ? value : '';
input.placeholder = 'None';
input.readOnly = true;
@@ -267,7 +267,7 @@ function createMaterialTextureEditor(
preview.classList.remove('es-has-preview');
};
- updatePreview(String(value ?? ''));
+ updatePreview((value && typeof value === 'string') ? value : '');
input.addEventListener('click', () => {
if (input.value) {