Adding Assets into CesiumJS error

Hi all,

New to Cesium and JS in general so this may be a glaring fix.
I’m following the " Visualize a Proposed Building in a 3D City" tutorial and have been running into issues in the “adding building to the scene” step.

Here is the code added with the asset ID of the building taken from the tutorial ;

const newBuildingTileset = await Cesium.Cesium3DTileset.fromIonAssetId(2287650);
viewer.scene.primitives.add(newBuildingTileset);

I get this error message in the console: Uncaught TypeError: Cesium.Cesium3DTileset.fromIonAssetId is not a function
at (index):65:48

Everything else loads fine up to that point and displays as if the code to add the asset doesn’t exist.
I have tried a few different variations of the function to call the asset, but they all result in the same error.
Tried loading the asset through Cesium Ion, and it works fine, but just can’t seem to get it to work in JS.

Really appreciate any assistance on this. Thanks!

PS. While the tutorials are great, I seem to find that the code provided doesn’t always work and I’ve had to replace some lines with variations I’ve found in other projects/ sandcastle/ documentation.

Hi there,

Do you know what version of CesiumJS you’re using? Those function were introduced in version 1.104.

You can get the version by logging Cesium.VERSION.

Hi Gabby,

Thanks for the reply. I just checked and it is on Version 1.82 which is the version you get when you follow the Glitch IDE link in the tutorial. Would you be able to point me to an updated version I can use on Glitch or some other IDE?
Again, I am a beginner in this and really appreciate the help.

Thanks

Hi @Isaac_Mui1,

Thanks, I think we’ll need to update the glitch link in that tutorial.

Try https://cesium.com/downloads/cesiumjs/releases/1.108/Build/Cesium/Cesium.js.