【提问】通过AssetInfo获得该Asset的Path的方法?

请问Cocos3.X 我获得了一个AssetInfo,要怎么获得这个Asset的Path?(在Bundle内的相对路径就可以了)之前2.X是有AssetInfo.path,3.X是没有的了
2.x的代码如下:
const path: string = bundle.getAssetInfo(uuid)?.path;、

编辑器环境的话可以试试编辑器方法。


截图来自 3.8.3 源码

const info = bundle.getAssetInfo(uuid);
const path = (info as any).path;

getAssetInfo接口返回的对象转换一下类型就行了,可以直接用any,或者真正的格式:__private._cocos_asset_asset_manager_config__IAddressableInfo

1赞

谢谢!解决了