Button to button connection effect

How would I go about making a button connect to another button via lines. Example from another game:


I presume it needs the script to calculate the distance required for the white line horizontally and vertically depending on the distance between the two buttons but how???

1 Like

What exactly are you trying to achieve with this?

Assuming that you are trying to do something similar to the image you provided…

I’m not a scripter but if the distance is going to be constant, couldn’t you just have a static UI element that appears or disappears when necessary? This is assuming the two things you want to connect are going to be in the same place every time.

But if you a going for something else, like this

I would recommend searching tutorials on how the game was made. But it looks like instead of calculating an entire line, it calculates it in parts, probably using the same calculation method as the placement of the tiles.

Hi, I figured it would be easier to do it with a straight line that has it’s own length and rotation that links the two buttons.