Swappable static mesh Blueprint at running time ? ( SOLVED )

Hey !

As a new user of Unreal Engine, i’ve been trying to make a blueprint that allows me to swap different meshes in the same location by just hitting key like 1, 2, 3 etc, per mesh at running time

I can’t find how to make it, maybe with array, or list but I’m too bad for making BP by myself.

Iwas wondering if someone could just send here a screenshot of a blueprint that could do what I explained earlier

It’s for an architectural project and i would like to swap mesh of different buildings to chose which is the best because I have already imported all elements of context

Thanks :slight_smile:

How are you choosing the buildings?

That’s the point. I have like 6 different meshes of building and I would like to be able to chose one to spawn by hitting a key, for exemple ‘’ 1 ‘’, then swapp for an other building with ‘’ 2 ‘’ etc I guess you know what I mean.

I got that bit! But you also said buildings previously - is there:

  • one building with several meshes

or

  • several building with several meshes.

If there are several, how would you like to choose which building’s meshes we are swapping around.


You also say spawn as if there was no building to start with. Are we swapping meshes of an existing building or spawning a new building and then swap its meshes.

Asking questions to suggest a tangible solutions.

The above got confusing. Ha. See how close is this to the desired result:

  • if i wanted an actor whose meshes can be swapped, I’d create a custom event in that actor and use an array to fetch the desired mesh

  • then, once you know which building we’re dealing with, you can:


The input above can be handled more gracefully. And if you need more building and select them somehow, this should be moved to the player controller.

It’s for an architectural project

If these are the only controls that are needed and there is little else interaction, it can be kept in the Level Blueprint. But controllers are handy.

i’m glad you are trying to understand, feel free to ask all the questions you need.

Here the meshes I want to swap. Each mesh is a building.

I previously try to create a BP with an actor class. I created an array including the meshes. Then I’ll place the Actor at the right location, but It could be nice to spawn one building as first then have the choice to replace it by other one.

Here a screen shot of the actor BP

Looks great !!!
Thank you

Let me try to recreate the BP in my project, I’ll be back in like 5 minutes

Would you mind telling me how to add the following actions:
-SwapMeshTo
-<=

It’s Less Than:

You can also copy / paste the nodes from:

May need to be clean it up, though.


SwapMeshTo

It’s a custom even you create yourself:

And you can parametrise it to pass data along:

image

1 Like

Possible to send nodes of :

Yes I created the event but don’t understand how you integrated the Mesh index with it

you integrated the Mesh index with it

You add parameters, see my last picture.

Regarding calling that custom event - we’re now back to my original question:

  • how many buildings with swappable meshes are there?
  • how do you select a building if there’s more than one?

The above was done in the level blueprint but depending on what is really needed it may not be a good idea to script things there, hence me grilling you :wink:

There is only one building with swappable mesh, i gues its solving the problem of selection

Finally could you explain me how did you add the Action: aBuildibg (from persistent level )

1 Like

Select the actor in the world, right click in the Level Blueprint

The LB is the scripting graph (and more) that is associated with the scene and can reference its actors directly:

It can also process player input. If you’re planning on having more than one level / map / architectural zone, I’d avoid scripting there.

To clarify: the custom event script goes into the building actor. The input goes into the level blueprint.

Also, avoid plopping down nodes without context:

If you need a target, for something, use the context sensitive nature of blueprint. Drag the wire first and then search - you will eliminate 1 million options that you do not need / make no sense.

Good luck!

Men on god you saved my life haha !

It works perfecly and it is the right result I’ve been expecting for a week.

I hope it’s gonna be helpful for other people and I wish you all the best thanks again ! :slight_smile:

1 Like