Dynamic Loading and Unloading of User-Instantiated Objects in Unity with Cesium For Unity Plugin

I am currently working on a project where I utilize the Cesium For Unity plugin for dynamic loading of terrain tiles based on the camera’s view. However, I am facing a challenge in extending this dynamic loading behavior to my user-instantiated objects that are placed on the Earth’s surface.

Is there any specific interface or method within the Cesium For Unity plugin that allows me to integrate my custom objects with the same dynamic loading strategy applied to the terrain tiles? I want my user-instantiated objects to load and unload dynamically based on their proximity to the camera’s view, similar to how the terrain tiles are handled.

Any insights, examples, or guidance on how to achieve this synchronization between custom objects and the Cesium For Unity’s terrain tile loading strategy would be highly appreciated.

Thank you!

Hey @jh007,

Unfortunately, there’s no direct entry point into the tile-loading algorithm, but I can give you some alternatives.

This may be a good use case for CesiumSubScene. A CesiumSubScene is defined by an origin in globe-relative coordinates, and an activation radius. Any game objects parented by the CesiumSubScene are considered as belonging to that sub-scene. That sub-scene will enable / disable itself whenever you enter or exit its radius. Our website has a tutorial that goes into more detail about how to use this component and build detailed sub-scenes.

The other option I could suggest is using Cesium ion to convert your models into 3D Tiles. Once you generate a tileset, you can click Adjust Tileset Location to position them on the globe. Then, you can stream them in as a 3D Tileset. I could see this being troublesome to maintain if you have numerous models, though, so this may not be right for your use case.

Hopefully one of these options is sufficient for you. But let us know if you have any other questions or concerns.