About the loading problem of `Cesium3DTileset(options) url`

I tried two different ways to create tileset.

const assetId = 8564
let tileset: Cesium3DTileset


//------ code 1 -------

tileset = new Cesium3DTileset({
    url: IonResource.fromAssetId(assetId )
})


//------ code 2 -------

const ionResource = IonResource.fromAssetId(modelData.assetId)
ionResource.then(
    (resource) => {
        tileset = new Cesium3DTileset({
            url: resource.url
        })
    }
)

code 1: Successfully loaded and displayed

code 2: Failed to load, got 401 or 404

Why?

@puxiao

Thank you for your question! The issue with the second code snippet is that the resource.url object is not being updated correctly. Thus when you try to use it as a URL, you get an error indicating that the compiler was not able to find the resource.

-Sam

Thank you for your answer.

1 Like

@puxiao

Of course! I am happy to help out :grinning:

Please let me know if you have any other questions.

-Sam