Im making a TD. I want to be able to set up spots where the player can build. So when a player click on “Build Tower” in the UI, the game will only let the player place that tower within certain fields that I chose. I’m guessing it’s something along the lines of a script that makes the placements only ok if it’s colliding with an actor? So I then can place all the “actors” (aka buildable spots) in the world. Idk how to set it up. Sorry for trash explanation, beginner at UE4.
In my opinion, it’s actually easier to place a blueprint where you can build each tower, in the level.
Then, when the level loads, you get all actors of type “tower base” (or whatever your blueprint is called) into an array.
Then, when the user wants to place a tower, you take the mouse position (in world space) and find the blueprint that has the closest position to that of the mouse.
Then you can draw the “ghost” image of the tower to be built snapped to that particular position.
Another alternative is to not even project the mouse, just put the “build tower here” action on the blueprint itself, as a mouse-click action. That’s even easier to implement, but it may not provide the UI you want – you’ll want to experiment a little bit here.