Firstly I made the inputs for the system being, 1-5 to place from the hotbar, CTRL to bulk place and Z to cancel the placement.
I also had to adapt the selection and clicked code to incorporate clicking to place and not hovering over units that are already place while placing a unit.
Below is a zoomed and updated bit of code within the placement system:

I created this to stop a visual glitch in the range indicators when a unit is already selected and you place a unit.
To to get the location on the screen under the mouse I discovered the node to use from: Anon (2014). How to Trace from screen mouse position to target in Blue Print. [online] Epic Developer Community Forums. Available at: https://forums.unrealengine.com/t/how-to-trace-from-screen-mouse-position-to-target-in-blue-print/279706/5 [Accessed 28 April 2026].
I used that to create the detection and the actual location to spawn the unit to.

This runs inside of the Parent unit to display the overlapping hitboxes of units in the way of the placement and also to gather the references of obstructions like the road the enemies walk along which will stop the placement and use the code in the image above to change the material to the correct colour

This code is mildly confusing (atleast for me writing it) as it runs half of the code within the unit thats being placed and the other half in the units colliding with it. Firstly ity checks if the road is being collided with, which runs universally in all BP_Unit children but since the placed ones arent moving it doesn’t actually run in them. Then it checks if the component touched is the collison box of the unit and if it is, is it the unit being placed. This code is then not running in the active unit but in the placed ones, since if the overlapped unit is the placed unit its sets its collision to red and adds itself to the obstruction array disabling the placement of the unit. This creates a cool effect of displaying which units are blocking your placement and also when u can place.
I will include a video of this in next weeks blog since the placement system wasn’t fully functioning without the unit selection systems UI input.

Leave a Reply