I need the ability to create streaming levels at runtime with Cesium for Unreal.
Since the CesiumGeoreference actor holds the list of streaming sublevels which are present in the Persistent Level, I was wondering if there was a way to dynamically create sublevels and append them to the CesiumGeoreference actor at runtime. This would allow me to create a DATA-DRIVEN location list.
The motivation for this is simply that the community needs a DATA-DRIVEN approach to location management. I have a database with a collection of LOCATIONS, with respective GeoCoordinates, which need to be dynamically loaded as levels in my application. It is not logical to hard code these levels in the application.
Hope that makes sense. It would be a powerful feature of Cesium for Unreal if it doesn’t exist yet. This is a show stopper for some of us I’m sure.
The link below illustrates someone in the Unreal Engine community describing their need for the feature as well. I figured to attack the problem from the Cesium-side in parallel with the effort on the Unreal Engine side.
The current sub-level system used in Cesium for Unreal is based on World Composition, which is deprecated in Unreal Engine 5. As such, we’re unlikely to make further major improvements to it before transitioning to UE5’s replacement, World Partitions. I wrote a note in the issue to remind us to consider runtime manipulation of sub-levels when we’re working on this:
Cesium for Unreal is open source, so if you’re up for it, you could definitely take a look at adding runtime sub-level manipulation yourself, and we’d be very interested in a pull request. The first step is to expose the relevant properties on CesiumGeoreference to Blueprints. That’s just a matter of adding a BlueprintReadWrite attribute to the relevant properties, in addition to the existing EditAnywhere.
The next problem will be that changing those properties via Blueprints won’t actually do much, because the changes are “applied” in the OnConstruction and PostEditChangeProperty methods that are invoked automatically in the Editor. The easiest solution is to add a BlueprintCallback method to apply updated settings on demand.
The most serious problem, though, will be that some of what CesiumGeoreference does with sub-levels is only doable at all inside of the Editor. The non-Editor build of Unreal Engine simply doesn’t have the capabilities compiled into it. You’ll see ifdefs for WITH_EDITOR around the code in CesiumGeoreference that uses these Editor features. It’s unclear how much of a deal killer this will be. At runtime, you probably don’t need to automatically discover new levels, for example. So this runtime-missing capabilities might not pose a big problem for your actual use-case.
If you give it a try, I’m very interested in hearing how you go.