From cb26c32ac71ec672c8075e857ba430dfe8b20a8f Mon Sep 17 00:00:00 2001 From: Untold Engine Date: Thu, 15 Oct 2026 17:13:28 -0700 Subject: [PATCH] Fix: resolve assets the Editor exports flat into Models/StreamModels/Animations getResourceURL only probed the nested Models//. form, but the Editor's asset exporter (RuntimeExportLocation.swift) has always cooked runtime assets flat into the category root (Models/.), beside the per-model support folder rather than inside it. External projects that load an asset by filename via setEntityMeshAsync never matched that layout and failed with "Filename not found", even though the identical file loaded fine through the Editor. Add the flat form as an additional probe so both cases resolve through the same code path. --- Sources/UntoldEngine/Systems/LoadingSystem.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sources/UntoldEngine/Systems/LoadingSystem.swift b/Sources/UntoldEngine/Systems/LoadingSystem.swift index 780a0068e..afd6e00a5 100644 --- a/Sources/UntoldEngine/Systems/LoadingSystem.swift +++ b/Sources/UntoldEngine/Systems/LoadingSystem.swift @@ -109,9 +109,16 @@ public func getResourceURL(resourceName: String, ext: String, subName: String?) // Flat layout (no top-level "Assets") var searchPaths: [[String]] = [ + // Nested form (Models//.) is checked first, then the flat + // form (Models/.) the Editor's asset exporter actually writes -- + // it cooks the runtime asset into the category root, beside the per-model + // support folder, rather than inside it. See RuntimeExportLocation.swift. ["Models", resourceName, "\(resourceName).\(ext)"], + ["Models", "\(resourceName).\(ext)"], ["StreamModels", resourceName, "\(resourceName).\(ext)"], + ["StreamModels", "\(resourceName).\(ext)"], ["Animations", resourceName, "\(resourceName).\(ext)"], + ["Animations", "\(resourceName).\(ext)"], ["HDR", "\(resourceName).\(ext)"], ["Gaussians", "\(resourceName).\(ext)"], ["Scripts", "\(resourceName).\(ext)"], @@ -132,8 +139,11 @@ public func getResourceURL(resourceName: String, ext: String, subName: String?) // Then try structured subdirectories let searchPaths: [[String]] = [ ["Models", resourceName, "\(resourceName).\(ext)"], + ["Models", "\(resourceName).\(ext)"], ["StreamModels", resourceName, "\(resourceName).\(ext)"], + ["StreamModels", "\(resourceName).\(ext)"], ["Animations", resourceName, "\(resourceName).\(ext)"], + ["Animations", "\(resourceName).\(ext)"], ["HDR", "\(resourceName).\(ext)"], ["Gaussians", "\(resourceName).\(ext)"], ["Scripts", "\(resourceName).\(ext)"],