Change Overlay with a button click in Play Mode

I’m hoping to run an interactive Cesium for Unreal session with some students using an Xbox controller. I have a number of raster Overlays as components in Cesium World Terrain (e.g. Bing imagery along with slope maps, geological maps via CesiumTMSoverlay). These are easy enough to cycle through in the editor by changing the Overlay priority, but I would ideally like to map a button on the Xbox controller (or keyboard) so that these overlays can be cycled in play. I’m guessing blueprints might provide a solution, but my inexperience has thus far been a barrier on that front. Any advice would be appreciated.

What have you tried and what didn’t work? You should be able to set the MaterialLayerKey property on each raster overlay and then call Refresh on each to make the change take effect.

Hi Kevin, thanks for getting back to me. I can get refresh working (thanks! I have no idea with Blueprints and didn’t really know where to even start). But how would I go about getting the MaterialLayerKey to change the rasters e.g. rotate each raster through Overlay0 (which is the raster that is actually shown)? Or should I be trying to map a key per raster (e.g. tell Cesium World Terrain to drape Overlay2 on top - not sure if this is possible?). I think the former would be best, being able to use the left and right gamepad D-pad to cycle overlays…?

If you only want to show one overlay, set the MaterialLayerKey of the one you want to show to Overlay0 and set the others to anything at all (NotShown, perhaps).

If you want to show multiple at a time but change their order, set the one you want on the bottom to Overlay0, the one you want drawn on top of that to Overlay1, and the topmost to Overlay2.

I have the Overlays arranged as 0, 1 and 2 (with the latter on top obviously) and have no issues changing them around in the viewport (e.g. just by change the Overlay priority and then pressing refresh on Cesium World Terrain). But how can I set the ordering up so that I can change this order by pressing a button in play (e.g. I ideally don’t want to have to exit play mode to cycle through the rasters)? I understand I can set Cesium World Terrain up to refresh on a button click in play, but it doesn’t reset to a new raster unless I can also trigger a change in the Overlay priority first?

Does that make sense? Sorry for the confusion.

Didn’t we just cover that? Create a Blueprint that changes the MaterialLayerKey in the way I described above when it’s triggered by whatever input events you want. If you need to brush up on Blueprints first, there are lots of tutorials, but I can’t write this for you. Writing people’s applications for them would take away time I’d rather spend making Cesium for Unreal better.

Ok sounds fair enough. Thanks for your help Kevin