I was wondering if it would be possible to allow access to the variables for Ion Asset ID on the Ion Raster Overlay component vis BP.
I’ve built a widget the allows me to cycle through a set of DEMs in my depot by simply setting the “Ion Asset ID” variable on the “Cesium3DTileset” actor. I was hoping to do the same for the Raster Overlay however when referencing this component, there is no way to set any of these variables.
I looked at Spawn Cesium3DTileset at runtime and the solution of “Add Ion Raster Overlay Component” doesn’t work as this node is only exposed in the Level Blueprint and only acts as a way to add a single overlay rather than changing to a new one.
The relevant variables of the raster overlay (namely the IonAssetID and the IonAccessToken) are not accessible via Blueprints, because changing these values at runtime is currently not possible.
(I’m omitting some technical details here, but roughly speaking: Just changing these values would not automatically reload and re-apply the overlay images to the tileset).
These values can only be set when the overlay is created. So for now, the only reasonable way to change the overlay at runtime via blueprints is to 1. destroy the old overlay and 2. add a new overlay with the new IonAssetID.
In order to destroy/remove such an overlay, you can use the DestroyComponent function.
Important: This function has to be called on the actor. You can not do this with a “standalone” DestroyComponent node! If you try that, you’ll receive an error of the form “LogActorComponent:Error: May not destroy component […component name…] owned by […actor…]”.
So you have to drag out a connection from the actor pin (the tileset, in this case), and search for “DestroyComponent” - note that you have to disable the “Context Sensitive” checkbox for this entry to appear:
Afterwards, you can add the new overlay component. (The steps for adding a raster overlay to a tileset via blueprints is described in the post that you already linked to ).
So the following is an example of a blueprint that
creates the tileset with a certain raster overlay
destroys the raster overlay after a few seconds
assigns a new raster overlay (with a different IonAssetId) after a few seconds:
@V2i As far as I know, there is currently task related to that and no issue that is tracking it. I think it has relatively low priority, because changing these values at runtime would mean that…
all the internal data structures would have to become invalidated when the values change. Considering that some resources are loaded asynchronously, implementing that cleanly could be rather complicated
after the values changed, everything has to be reloaded, as-if a new raster overlay component was attached - so there wouldn’t be a performance benefit either
Destroying the old and assigning a new overlay seems to be a good trade-off here, in the space of “easyness”, “safety”, “cleanliness”, and “usability”.
If I am overlooking a severe limitation (i.e. an important use-case that cannot be covered), then this could be tracked in a dedicated issue.
The use case we have in mind is a little different to others making singular games, ours is focused on providing land developers a “sketchpad”:
The build is given to a user as a blank slate. They have player controls, some sketching and various tools, the Cesium World Terrain with Bing Aerial Imagery.
They are supplied a UI that is sort of a layer editor where they can add various overlays to the scene.
With the current limitation these aren’t configurable, the created raster component has to be assigned the Access Token and Asset ID prior to building which means we can only ever supply preset overlays which doesn’t fulfill our use case.
This is what we are doing currently. Hardcode a few add raster overlay’s but it’s is not easily configurable and the end user has limited options. Ideally it would be good to have a AssetID to configure before the component is added perhaps?
Our use case is probably very different to most other devs so I understand why it’s a lower priority but it would be a good to have feature to be able to configure the AssetID and AccessToken at runtime.
Raster Overlay properties will be settable from Blueprints in our next release, scheduled for the middle of the week. If you change properties after the raster overlay component is activated, you’ll need to explicitly call “Refresh” on it to apply its changes.
For anyone who finds this thread in the future, the change Kevin mentioned above has been merged and you can now access these properties via Blueprint. You can see an example blueprint to change the overlay on Cesium World Terrain here: