Static Mesh swap blueprint

Hi,

I have created a blueprint that switches between two static meshes with a keyboard input. This is working fine, however I can’t see a way where I could toggle between three objects. I seem to be switching one off and one on. Could someone please let me know a better way of doing this?

Thanks.

Hey you can simply use a counter and a switch on int node to toggle between static meshes. Increment the counter whenever you press F and reset it back to zero when the counter reached the max value.

Hit the “Add Pin” button on the multigate and there will be a third pin. You can do the same visibility hiding thing you’re doing.

If you want to switch between a lot of meshes, you can use Set Static Mesh instead of set Visibility. That will change both the visual and the collision. It also means you only have to use one blueprint, and each new mesh you add, you just add one blueprint for that specific mesh, instead of one blueprint for that mesh and a blueprint for hiding each other mesh.

I am not certain how you would set that up to be honest. But thank you for replying.

Thanks for the reply. I am looking to switch between 4-5 meshes so I think the Set Static Mesh option is the one I need to go for. How do I arrange the nodes though. I can set 1 new mesh but how do I give the nodes multiple options to cycle through? I have included my basic setup.

Ok so I have figured out how to cycle through objects, could someone please help with making the items loop back to the beginning once they have been cycled through?

Sorry, just saw that you had another question. My original thought was just to hook the Set Static Mesh up to the multigate you were using before. Each output of the multigate would have it’s own Set Static Mesh.

But I can see what you’re getting at, there’s a cleaner, more flexible way to do it, something like this:

You can put all your meshes in an array, then keep track of what one’s currently loaded in (that’s new_var_0) and just increment up and roll over to zero once you get to the last mesh. That way when you want another mesh, you just add it into the array and you don’t have to edit any blueprints.

EDIT: (you’ll have to hook both the Get and the Length to your mesh array)

Just add a multigate before set static mesh and set it to loop on the multigate and youre all set!