Detect if "Tile" is overlapping and move overlapped "Tiles" aside

I’m trying to make a mechanic where player can move tiles around with mouse and when tile is overlapping another tile it moves the tile behind the overlapped tile. I got that part working, but what I have trouble with at the moment is when the moved tile is overlapping another tile and mouse is not released I want the overlapped tile to move aside to make the room for your tile, and when actor ends overlap and player chose not to place the tile there I want the tile to move back.

what I currently have (Actor component)

  • At the moment I have bind event on mouse click I set “Moving” Boolean to true that I started to move the tile. And I set the actor location to my mouse location with event tick.

-On mouse release I set “Moving” Boolean to false that I no longer move the tile.

-When moving a tile around with mouse and it overlaps with another tile I check if “Moving” is true if it is then I set “overlapped actor” Variable from the other actor it hit & when I end overlap I also check the “Moving” Boolean and I null the “Overlapped actor” variable.

  • Now I need to figure out how to move tile aside on overlap and back on end overlap and eventually I need to save text variable (each tile has letter or number value) when snapping tiles together.