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: use assetServer.baseUrl as fallback in scene asset preloading

esengine486f2c64089b
diff --git a/sdk/src/scene.ts b/sdk/src/scene.ts
index 7279899a6..88846960a 100644
--- a/sdk/src/scene.ts
+++ b/sdk/src/scene.ts
@@ -234,7 +234,7 @@ export async function loadSceneWithAssets(
options?: SceneLoadOptions
): Promise<Map<number, Entity>> {
const assetServer = options?.assetServer;
- const baseUrl = options?.assetBaseUrl;
+ const baseUrl = options?.assetBaseUrl ?? assetServer?.baseUrl;
const texturePathToUrl = new Map<string, string>();
if (assetServer) {
@@ -321,8 +321,6 @@ async function preloadSceneAssets(
texturePathToUrl: Map<string, string>,
collectAssets?: LoadedSceneAssets,
): Promise<void> {
- sceneData = JSON.parse(JSON.stringify(sceneData));
-
const assetPaths = new Map<AssetFieldType, Set<string>>();
for (const type of ASSET_FIELD_HANDLERS.keys()) {
assetPaths.set(type, new Set());