Download

Affect multiple assets in one go?

Hi, I’m just trying to get my head round Blueprints for the first time. I’m making an Arch Vis campus management tool with a blocky overview of a range of buildings. I’d like for users to be able to click on a range of icons on the UI, or keyboard commands, and have large amounts of assets change their base colour at the same time.

I’ve found tutorials that show me how to change one asset. Do I have to repeat the process for each of the 60+ assets? Or is there a way of somehow ‘grouping’ them and scripting it all on one screen? And I’m not too clear where I should be constructing it - the Level Blueprint, or the User Interface widget system?

Any advice, or pointers to relevant tutorials, very welcome!

A few ways:

  1. Make all of the Actors that you want to change the same (base) class and use Get All Actors of Class

  2. Add a tag to all of the Actors you want to change and use Get All Actors with Tag

  3. Add a BP Interface to all of the Actors you want to change and use Get All Actors with Interface

I’d advise against implementing things in the Level BP unless you’re sure you will only ever use that one particular level. You could put it in a user widget, but it’s probably cleaner to put it somewhere in a custom Player Controller or GameModeBase.

Thanks - that gives me a good starting point. Much appreciated.

Just trying to implement this. I’ve dragged my static mesh assets into the viewport and got some code picking out the correct elements by tag - happy days :slight_smile:

Next challenge is then affecting the meshes. Do they need to be created via a BP to allow me to edit their material? In which case, do I need to make a separate BP for each mesh? That would be massively time consuming…

Yes, if you look in the World Outliner on the right, the meshes automatically get “wrapped” with a StaticMeshActor when they are added to the level.

But since you want them to implement custom behavior, it would probably be best to create your own Actor subclass (or StaticMeshActor subclass) that implements that behavior. Then use one of the “Get All Actors” nodes I mentioned above to run some sort of “Change Color” function on them that you define.

Thanks. Any idea on guidance for how to create a subclass? Is it a case of somehow saving an Actor BP as a template-type file, with the function ready in place? Adding a Blueprint script to a StaticMeshActor seems to essentially convert it into a BP. I guess if I then create a ‘Change Colour’ function, I’ll need to create a BP for each mesh in my scene, and paste the same function into each one? Seems very time consuming!