解析“资产”

你好!

解析“资产”的最佳方式是什么?

 parseLDtk() {
        if (this._ldtkAsset) {

            // 解析内容
            const asString = this._ldtkAsset.toString();
            const serialize = this._ldtkAsset.serialize();
            const native = this._ldtkAsset._nativeAsset;
            console.log(asString); // assets/general/native/54/5473bf97-839e-4d11-af5d-acd2e30bfaf4.ldtk
            console.log(serialize); // undefined
            console.log(native); // 好的,但已弃用
        }
    }

任何想法 ?

I tend to think that assets are something developers “actively store and don’t need to parse,” meaning that at the business level, they should be clear about the purpose of each loaded asset. Of course, there may be a need to parse raw assets for flexibility or decoupling, but it’s best to access them through the asset’s own API, depending on the specific asset type. Additionally, there is a getAssetInfo on the bundle to query assetInfo.url

BTW, 最近我们很重视海外社区的响应速度,如果需要使用英文更深入讨论,建议加入discord社区,或者在英文论坛发帖。