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.

feat: add missing asset indicator, UUID display, and prefab info improvements

esengine552328dd4171
diff --git a/editor/src/panels/inspector/AssetInspector.ts b/editor/src/panels/inspector/AssetInspector.ts
index 5f96936ba..d9dda1a25 100644
--- a/editor/src/panels/inspector/AssetInspector.ts
+++ b/editor/src/panels/inspector/AssetInspector.ts
@@ -16,6 +16,19 @@ export function renderAssetHeader(container: HTMLElement, asset: AssetSelection)
<span class="es-asset-header-name">${escapeHtml(asset.name)}</span>
`;
container.appendChild(header);
+
+ const entry = resolveAssetEntry(asset.path);
+ if (entry) {
+ const meta = document.createElement('div');
+ meta.className = 'es-asset-meta-info';
+ meta.innerHTML = `
+ <span class="es-asset-meta-uuid" title="Click to copy">${escapeHtml(entry.uuid)}</span>
+ `;
+ meta.querySelector('.es-asset-meta-uuid')?.addEventListener('click', () => {
+ navigator.clipboard.writeText(entry.uuid);
+ });
+ container.appendChild(meta);
+ }
}
export function resolveAssetEntry(assetPath: string) {
diff --git a/editor/src/panels/inspector/EntityInspector.ts b/editor/src/panels/inspector/EntityInspector.ts
index fb723c1be..94d815e0a 100644
--- a/editor/src/panels/inspector/EntityInspector.ts
+++ b/editor/src/panels/inspector/EntityInspector.ts
@@ -23,7 +23,7 @@ import {
getComponentIcon,
getProjectDir,
} from './InspectorHelpers';
-import { isPropertyOverridden } from '../../prefab';
+import { isPropertyOverridden, hasAnyOverrides } from '../../prefab';
import {
getComponentInspector,
getInspectorSections,
@@ -101,24 +101,30 @@ function renderPrefabInfoBar(
store: EditorStore
): void {
const prefab = entityData.prefab!;
- const pathDisplay = prefab.prefabPath.split('/').pop() ?? prefab.prefabPath;
+ const resolvedPath = isUUID(prefab.prefabPath)
+ ? (getAssetLibrary().getPath(prefab.prefabPath) ?? prefab.prefabPath)
+ : prefab.prefabPath;
+ const pathDisplay = resolvedPath.split('/').pop() ?? resolvedPath;
const bar = document.createElement('div');
bar.className = 'es-prefab-info-bar';
bar.innerHTML = `
${icons.package(12)}
- <span class="es-prefab-info-path es-prefab-info-link" title="${escapeHtml(prefab.prefabPath)}">${escapeHtml(pathDisplay)}</span>
+ <span class="es-prefab-info-path es-prefab-info-link" title="${escapeHtml(resolvedPath)}">${escapeHtml(pathDisplay)}</span>
`;
const pathEl = bar.querySelector('.es-prefab-info-link');
pathEl?.addEventListener('click', () => {
- getEditorInstance()?.navigateToAsset(prefab.prefabPath);
+ getEditorInstance()?.navigateToAsset(resolvedPath);
});
if (prefab.isRoot) {
+ const overridden = hasAnyOverrides(store.scene, prefab.instanceId);
+
const revertBtn = document.createElement('button');
revertBtn.className = 'es-btn';
revertBtn.textContent = 'Revert';
+ revertBtn.disabled = !overridden;
revertBtn.addEventListener('click', () => {
store.revertPrefabInstance(prefab.instanceId, prefab.prefabPath);
});
@@ -126,6 +132,7 @@ function renderPrefabInfoBar(
const applyBtn = document.createElement('button');
applyBtn.className = 'es-btn';
applyBtn.textContent = 'Apply';
+ applyBtn.disabled = !overridden;
applyBtn.addEventListener('click', () => {
store.applyPrefabOverrides(prefab.instanceId, prefab.prefabPath);
});
diff --git a/editor/src/property/editors.ts b/editor/src/property/editors.ts
index 7ac9e32c4..475e507c9 100644
--- a/editor/src/property/editors.ts
+++ b/editor/src/property/editors.ts
@@ -664,6 +664,19 @@ function resolveDisplayName(ref: string): string {
return ref;
}
+async function checkAssetMissing(ref: string, input: HTMLInputElement): Promise<void> {
+ if (!ref) {
+ input.classList.remove('es-missing-asset');
+ return;
+ }
+ const path = resolveToPath(ref);
+ const projectDir = getProjectDir();
+ const fs = getNativeFS();
+ if (!path || !projectDir || !fs) return;
+ const exists = await fs.exists(`${projectDir}/${path}`);
+ input.classList.toggle('es-missing-asset', !exists);
+}
+
function resolveToPath(ref: string): string {
if (!ref) return '';
if (isUUID(ref)) {
@@ -761,6 +774,7 @@ function createTextureEditor(
currentRef = (value && typeof value === 'string' && value !== String(INVALID_TEXTURE)) ? value : '';
updatePreview(currentRef);
+ checkAssetMissing(currentRef, input);
input.addEventListener('click', navigateToAssetPath);
preview.addEventListener('click', navigateToAssetPath);
@@ -859,6 +873,7 @@ function createTextureEditor(
if (newValue !== currentRef) {
currentRef = newValue;
updatePreview(newValue);
+ checkAssetMissing(newValue, input);
}
},
dispose() {
@@ -981,6 +996,7 @@ function createSpineFileEditor(
input.className = 'es-input es-input-file';
input.value = resolveDisplayName(String(value ?? ''));
input.placeholder = 'None';
+ checkAssetMissing(String(value ?? ''), input);
const browseBtn = document.createElement('button');
browseBtn.className = 'es-btn es-btn-icon es-btn-browse';
@@ -1038,7 +1054,9 @@ function createSpineFileEditor(
return {
update(v: unknown) {
- input.value = resolveDisplayName(String(v ?? ''));
+ const ref = String(v ?? '');
+ input.value = resolveDisplayName(ref);
+ checkAssetMissing(ref, input);
},
dispose() {
wrapper.remove();
@@ -1056,10 +1074,7 @@ interface SpineSkeletonData {
}
async function loadSpineSkeletonData(skeletonPath: string, atlasPath?: string): Promise<SpineSkeletonData | null> {
- if (!skeletonPath) {
- console.warn('[SpineEditor] skeletonPath is empty, cannot load skeleton data');
- return null;
- }
+ if (!skeletonPath) return null;
const editor = getEditorInstance();
if (editor) {
@@ -1067,7 +1082,6 @@ async function loadSpineSkeletonData(skeletonPath: string, atlasPath?: string):
if (entityId !== null) {
const info = editor.getSpineSkeletonInfo(entityId);
if (info) {
- console.log(`[SpineEditor] Loaded from runtime: ${info.animations.length} animations, ${info.skins.length} skins`);
const animRecord: Record<string, unknown> = {};
for (const name of info.animations) {
animRecord[name] = {};
@@ -1077,39 +1091,23 @@ async function loadSpineSkeletonData(skeletonPath: string, atlasPath?: string):
skins: info.skins.map(name => ({ name })),
};
}
- console.warn(`[SpineEditor] Runtime info not available for entity ${entityId}, falling back to file`);
- } else {
- console.warn('[SpineEditor] No entity selected');
}
- } else {
- console.warn('[SpineEditor] Editor instance not available');
- }
-
- const projectDir = getProjectDir();
- const fs = getNativeFS();
- if (!projectDir || !fs) {
- console.warn(`[SpineEditor] Cannot read file: projectDir=${projectDir}, fs=${!!fs}`);
- return null;
}
if (skeletonPath.endsWith('.skel')) {
- console.warn(`[SpineEditor] Binary .skel format cannot be parsed as fallback, need runtime instance for: ${skeletonPath}`);
return null;
}
+ const projectDir = getProjectDir();
+ const fs = getNativeFS();
+ if (!projectDir || !fs) return null;
+
const jsonPath = `${projectDir}/${skeletonPath}`;
try {
const content = await fs.readFile(jsonPath);
- if (!content) {
- console.warn(`[SpineEditor] File is empty or not found: ${jsonPath}`);
- return null;
- }
- const data = JSON.parse(content) as SpineSkeletonData;
- const animCount = data.animations ? Object.keys(data.animations).length : 0;
- console.log(`[SpineEditor] Loaded from file: ${animCount} animations from ${jsonPath}`);
- return data;
- } catch (err) {
- console.warn(`[SpineEditor] Failed to load spine skeleton from ${jsonPath}:`, err);
+ if (!content) return null;
+ return JSON.parse(content) as SpineSkeletonData;
+ } catch {
return null;
}
}
@@ -1131,7 +1129,6 @@ function createSpineAnimationEditor(
container: HTMLElement,
ctx: PropertyEditorContext
): PropertyEditorInstance {
- console.log(`[SpineEditor] createSpineAnimationEditor called, value="${ctx.value}"`);
const { value, onChange, getComponentValue } = ctx;
const wrapper = document.createElement('div');
@@ -1172,9 +1169,6 @@ function createSpineAnimationEditor(
const skeletonRef = getComponentValue?.('skeletonPath') as string;
const skeletonPath = skeletonRef ? resolveToPath(skeletonRef) : '';
if (!skeletonPath) {
- if (skeletonRef) {
- console.warn(`[SpineEditor] skeletonRef="${skeletonRef}" resolved to empty path`);
- }
updateOptions([], String(value ?? ''));
return;
}
@@ -1186,7 +1180,6 @@ function createSpineAnimationEditor(
const animations = getAnimationNames(data);
updateOptions(animations, String(value ?? ''));
} else {
- console.warn(`[SpineEditor] No skeleton data loaded for: ${skeletonPath}`);
updateOptions([], String(value ?? ''));
}
};
@@ -1195,7 +1188,6 @@ function createSpineAnimationEditor(
const unsubSpineReady = editor?.onSpineInstanceReady((entityId) => {
const selected = editor.store.selectedEntity as number | null;
if (selected === entityId) {
- console.log(`[SpineEditor] Spine instance ready for entity ${entityId}, reloading animations`);
loadAnimations();
}
}) ?? null;
@@ -1359,6 +1351,7 @@ function createMaterialFileEditor(
input.value = resolveDisplayName(String(value ?? ''));
input.placeholder = 'None';
input.readOnly = true;
+ checkAssetMissing(String(value ?? ''), input);
const browseBtn = document.createElement('button');
browseBtn.className = 'es-btn es-btn-icon es-btn-browse';
@@ -1456,7 +1449,9 @@ function createMaterialFileEditor(
return {
update(v: unknown) {
- input.value = resolveDisplayName(String(v ?? ''));
+ const ref = String(v ?? '');
+ input.value = resolveDisplayName(ref);
+ checkAssetMissing(ref, input);
},
dispose() {
wrapper.remove();
@@ -1483,6 +1478,7 @@ function createBitmapFontFileEditor(
input.value = resolveDisplayName(String(value ?? ''));
input.placeholder = 'None';
input.readOnly = true;
+ checkAssetMissing(String(value ?? ''), input);
const browseBtn = document.createElement('button');
browseBtn.className = 'es-btn es-btn-icon es-btn-browse';
@@ -1580,7 +1576,9 @@ function createBitmapFontFileEditor(
return {
update(v: unknown) {
- input.value = resolveDisplayName(String(v ?? ''));
+ const ref = String(v ?? '');
+ input.value = resolveDisplayName(ref);
+ checkAssetMissing(ref, input);
},
dispose() {
wrapper.remove();
diff --git a/editor/src/styles/editor.css b/editor/src/styles/editor.css
index 8f6d8e77e..358b979ff 100644
--- a/editor/src/styles/editor.css
+++ b/editor/src/styles/editor.css
@@ -378,6 +378,18 @@ svg {
padding: 4px 0;
}
+.es-hierarchy-scroll-content {
+ position: relative;
+ min-height: 100%;
+}
+
+.es-hierarchy-visible-window {
+ position: absolute;
+ left: 0;
+ right: 0;
+ will-change: transform;
+}
+
.es-hierarchy-item {
user-select: none;
position: relative;
@@ -391,6 +403,8 @@ svg {
cursor: pointer;
border-left: 2px solid transparent;
position: relative;
+ height: 22px;
+ box-sizing: border-box;
}
.es-hierarchy-row:hover {
@@ -983,6 +997,27 @@ svg {
word-break: break-all;
}
+.es-asset-meta-info {
+ padding: 2px 10px 6px;
+ background: var(--es-bg-secondary);
+ border-left: 1px solid var(--es-border);
+ border-right: 1px solid var(--es-border);
+ border-bottom: 1px solid var(--es-border);
+ margin-top: -5px;
+ margin-bottom: 4px;
+}
+
+.es-asset-meta-uuid {
+ font-size: 11px;
+ color: var(--es-text-muted);
+ cursor: pointer;
+ user-select: all;
+}
+
+.es-asset-meta-uuid:hover {
+ color: var(--es-text-secondary);
+}
+
.es-asset-preview-section {
margin-bottom: 4px;
background: var(--es-bg-secondary);
@@ -3109,6 +3144,10 @@ svg {
text-decoration: underline;
}
+.es-missing-asset {
+ color: #ff6b6b !important;
+}
+
/* =============================================================================
* Spine Animation/Skin Editor
* ============================================================================= */