I want to dynamically add multiple Sub-Scenes in Unity through code, with each Sub-Scene used to store a terrain. I can only add Sub-Scenes in edit mode now, and I haven’t found an API for adding Sub-Scenesat runtime. How can I solve this problem?
You should be able to just create a GameObject and add a CesiumSubLevel component to it, just like you would do in the Editor (and just as you would any other Unity component). Did you try that and run into trouble?
Does Unity support adding multiple terrains?
Yes, but if both cover the same area, they’ll overlap. Whichever one has higher elevation will poke through the one below and be visible. It may help to explain what you’re actually trying to do. Cesium ion can layer terrain on top of an existing terrain tileset, presenting them together as one tileset to Cesium for Unity. I suspect that’s closer to what you have in mind.
For example, if I want to add multiple terrains and images now, should I add an empty game object and add multiple “Cesium 3DFileset” and “Cesium Tile Map Serve Raster Overlay” components, or should I add multiple game objects and add components separately?
I suggest a separate Game object for each Cesium3DTileset.
Can the “Cesium 3DFileset” and “Cesium Tile Map Serve Raster Overlay” components be placed separately in an empty game object, and then both the image and map can be displayed on the map
No. A CesiumRasterOverlay displays nothing unless it is paired with a Cesium3DTileset. There’s no “map” to display an image on without a tileset.
So, adding multiple images is achieved by adding a Cesium 3DFileset and multiple Cesium Tile Map Serve Raster Overlays to an empty game object, right?
Do you want to draw multiple overlays draped over a single globe surface? If so, you should create one game object and add to that game object:
- One Cesium3DTileset for Cesium World Terrain or whatever globe geometry you want to use.
- Two CesiumRasterOverlay-derived components, one for each overlay you want to drape over it.
That’s assuming your overlays cover disjoint parts of the globe, or the top one has some translucency so that the bottom one can be seen through it.