Multiple meshes on/off

How can i add multiple static meshes to some sort of group or node in the blueprint? Im essentially making a configurator in Unreal, and i need to be able to turn on and off lots of meshes with the press of a key.

Below you can see an example of a blueprint i have made which changes the material on a single mesh. I have another similar blueprint working which switches a single meshes visibility in game. The problem is i cant figure out how to use multiple assets/meshes together and in 1 blueprint.

So what do i need to use to have 10 or 50 meshes “grouped” into a node or something like that, so i can then link it to my material/visibility node?

I could really do with some help here as im not used to the BP editor and ive been googling solutions for days with no luck.

Is it possible to store the components in an array and iterate over the array? Using a for loop? Sorry if this is wrong I’m a newbie

I’ve looked into using a static mesh Array, but again im really struggling with how to use that with my visibility or material node. The array looks like i can add as many meshes to it as needed which is good, but i honestly am lost with what node comes after the Array in the BP editor.

When i make a new array in the “variables” section on the left of the BP editor, i kinda get the set up process for the array, but when i then drag that into the event graph editor, i cant attach it to a SetVisibility or SetMaterial node.

Would you be able to show an example of this if possible? It would be greatly appreciated!

Umm I’m not in front of the computer atm but could you drag off the array and do a foreach node and then drag off the array element I think it’s called and do a setvisibility or setmaterial node from that

So I made a array of type “Static mesh component” then used a foreach loop, and dragged the pin off the array element and done a setvisibility node

This appears to work with the “static mesh component” array type but not the “static mesh” array type. I might be in over my head here but I hope it works

Thank you for the screenshot! I will definitely give this a go and let you know how it turns out!

Your welcome, did you end up getting it to work at all?

Hi :). It was 2am when i responded last night, I have had a bit of time and I have reproduced the behaviour I think you are looking for and have a better explanation.

I have made a blueprint with 3 static meshes, 2 chairs and a table, and I will use a key to toggle the chair visibility. Hopefully this simulates what you are trying to achieve.

First step is to create a blueprint and add the static meshes that you want.

Second step is to create an array of type “Static mesh component”

276807-staticmeshcomponent.jpg

Make sure you turn the variable into an array with the little grid icon like so:

276808-variabletype.jpg

Then you must enable input into the blueprint and add the static meshes into the array:

Then you can use your for loop with set visibility to toggle the visibility, like so:

Using this method I was able to create a blueprint where I can toggle the visibility of the chairs by pressing and releasing the E key.

Hope this is helpful

No worries :slight_smile: here is how the static meshes are laid out in the heriarchy:

276812-heirarchy.jpg

Thank you so much for this! Im giving it a go right now

Just a quick question. Should i be making this in the “Level Blueprint”? or should i make a new “blueprint actor”?

In the “Array” where it says “default value” am i suppose to add all my mesh elements in here? or am i just adding them in the “component” tab at the top left?

If so, its looking like i might have 50+ meshes i want to turn on or off and this would be very time consuming to do. I thought the array would get around this issue by allowing me to add everything in each array i need? Or am i totally mistaken haha

By the way, the screenshots you’ve posted are really helpful!

I made a blueprint actor and added the static meshes in the components tab. I am not sure how to add them as default values, it seems like something you should be able to do but i can’t figure out how atm. I have added array elements to the default values and it has an area to add meshes, but there is nothing in the drop down list which seems strange.

I don’t really know how to do this, I will have a look on google and see if there is a way to do it

It looks like there is a way to do this using component tags, I’ll get some screen shots

Ok so first thing to do is to select all your static mesh components using shift+Click

276813-selectall.jpg

Then in the details panel, assign them a tag

276814-tag.jpg

Then make a “Get components by tag” node, this will return an array of components. Be sure to select static mesh component as the compnent class

276815-getcomponentsbytag.jpg

Then add them to your input action instead of the initial array

This will affect all components with the given tag. I believe this is the functionality you are looking for

this way there is no need to create and populate an array, just give all the components a tag and use that get component by tag node, and it will affect all components with that tag

Thanks again for the info! I’ve built the blueprint based of your screenshots and things seem to work which is good news. Im currently looking into scaling this up without it being extremely tedious haha. I’ll let you know of my progress!

Yes it works!!! Thank you so much for all the help!

If i can one more question for you, is it possible to use a multigate node, or something similar so i can cycle through 3 different objects for example? Currently im using a keyboard “Z” input as im aiming to cycle/loop through meshes.

Thank you again for being so helpful!

This is absolutely perfect! 10/10

You’ve been a great help with this, cant thank you enough!