If I want to create a very simple Editor Utility Widget to simply toggle the visibility of a specific static mesh already in the level, what’s the proper way to access that static mesh?
Most Editor Widget examples require the user to select something but in this case, I have specific items I want to manipulate. Is it possible to name an asset to get a reference to?
Static Mesh is an asset, in the scene you will have actors such as Static Mesh Actors or Blueprint instances that have a static mesh component that refers to your static mesh.
What you want to do is change visibility on that/those actor(s).
For that you will have to search among all actors in your level for the one with your static mesh:
- select the actor matching a string for its name or label
- select the actor matching a string for one of its metadata
- select the actor that has a static mesh component that reference your static mesh
There is a “Select Actors Using This Asset” in the editor but this function is not accessible to blueprint AFAIK.
1 Like
Thanks. I had started down that route and so got it working. I had thought there might be a more direct route rather than searching every item in the level. I used Tags which made it easy to reuse the code for anything and to control multiple items at the same time.