diff --git a/source/main.ts b/source/main.ts index d401fb2..13b8d88 100644 --- a/source/main.ts +++ b/source/main.ts @@ -368,7 +368,13 @@ export const methods: { [key: string]: (...any: any) => any } = { } // 预制体资源 else if (type === 'cc.Prefab') { - const uuid = source[source.length - 1]['asset']['__uuid__']; + let uuid: string | undefined = undefined; + for (let i = source.length - 1; i >= 0; i--) { + if (source[i]['asset']) { + uuid = source[i]['asset']['__uuid__']; + break; + } + } nodeTree['__type__'] = 'cc.Prefab'; // 类型 nodeTree['__uuid__'] = uuid; // uuid // 从根节点开始读取