Set visibility/spawn actor of Cesium3DTileset with button in Widget Blueprint (UE 5.3)

Hello,

I have many Cesium 3D tileset layers in my Unreal project, which should always be visible (terrain, buildings). However, certain 3D tiles are hidden when the game starts.

Now I would like to make individual tilesets visible with buttons in the Blueprint widget. So that Hidden in Game deactivates when clicking on the button.

How can I control the individual 3DTiles (e.g. floods, trees,…) in the Blueprint widget and then link them to the On clicked button? The 3D tiles cannot be called up with “Get all actors of class”. And SpawnActor is also not accessible in the Blueprint widget.

Thank you very much!

Hi @L_N,

How scalable do you want this to be? In other words, do you want this to work for a small, unchanging number of tilesets? Or should this work with an arbitrarily large number of tilesets?

My first answer would be to drag the tileset from the World Outliner into the Blueprint, creating a reference to the tileset in the level. Then, assign each tileset its own button, so that it toggles the tileset’s visibility. If this doesn’t work for you, though, let us know more details about your use case so we can give a more informed answer. Thanks!

Hi @janine

I want to implement the show/hide function for a small number (5) of 3D tilesets in my game widget as buttons.

I can only drag the corresponding tileset from the World Outliner into the Level Blueprint. However, I need the tileset in the Widget Blueprint, where I can also define the buttons. So how do I get a reference to the Cesium 3D tilesets in the Widget Blueprint, not Level Blueprint?


In the Widget Blueprint (Widget with Buttons) I have no acces to the 3DTilesets from the outliner.

Hi @L_N,

Thanks for explaining. I found a resource that might be what you’re looking for on Reddit. To summarize,

  1. Create a new Actor type variable in your widget.
  2. In the settings, enable Instance Variable and Expose on Spawn
  3. When you spawn the widget with Create Widget, you can set this actor variable with a reference to your desired tileset:
  4. Then you can act on the tileset from the widget’s blueprint.

I hope that helps. Let me know how it goes!

Thanks for the reply @janine .

I have now created the actor variable “Tileset HQ100” in my Widget Blueprint with the above settings.

The Play widget is now loaded in the Level Blueprint and the corresponding Cesium 3DTile is linked to the “Tileset HQ100” variable from the Widget Blueprint.

When clicking on the button in the Blueprint widget, the Cesium 3DTile should be hidden. However, the widget should of course remain visible. Unfortunately, I get an access error (Accessed non trying to read property … EventGraph Function … Execute Ubergraph Level Blueprint).

@janine Is there any other method to show/hide Cesium 3D tilesets (HQ100 in my case) with a button during the game? Does this possibly have to be solved via GameInstance? like most users of conventional GIS programs are used to!

Hi @L_N, I’m so sorry for the delayed response. This one slipped off my radar.

I’m not very familiar with the Unreal Widget system, so I’m confused why the Blueprint isn’t working.
In theory it shouldn’t be really hard, you could just toggle the visibility of the tileset like any other actor in the game. But I’m not sure why the widgets are acting differently. Could you share the access error that you’re seeing?

I’m also not sure what GameInstance means here; it would help if you could explain :sweat_smile: