How to change Mesh accodring the environemnt?

Hello All,

I am trying to make simple game test, but can’t get around the concept, or the best solution.

In 4 by 4 grid, there are 16 slots. By pressing the button (tube, see ref) you can put a tube in any slot.

Once placed slot changes it mesh to tube (lets say, tube_01) (Step.2 on ref)

Next, pressing the tube button and placing new tube to neighboring slot, both slots change the mesh so they will be connected. (Step. 3 on ref)

On step. 6, we can see that placing new tube between two slots with tube will change both so they can connected.

What I have done so far,

I have created BP_tube
It has 4 collision box on each side, to check for other BP_tubes and 1 in the middle so other BPs`s collision boxes can overlap it.

Also in graph, have a switch node with connected mesh components. But it is not connected nor working, since I have no idea how to make BP check surrounding on all sides and transform accordingly.

I was thinking, on placing (spawning) BP_tube, to run event dispatcher to call event in all BP_tubes to check surrounding and transform accordingly, as I do not wasn’t to check the surroundings on tick, but only when placing new tube.

Any ideas on how to make such mechanics?

There is a very similar thing demonstrated in BP code, in an Unreal Live Training for the Turn-Based Strategy game project. There, they select a mesh based on neighboring tiles, whether they are empty or filled.

I think this is the one:

Thank you! But the provided link didn`t solve my problem, It seems too complex for me to grasp at this point, also tutor goeas through it too fast, seems like it was for advanced users.